/* Responsive Design - Mobile First Approach */

/* Extra small devices (phones, less than 576px) */
@media (max-width: 575.98px) {
    /* Header adjustments */
    .dashboard-header {
        padding: 0 0 2rem 0;
        clip-path: polygon(0 0, 100% 0, 100% 90%, 0 100%);
    }
    
    .prism-logo {
        font-size: 1.5rem;
        letter-spacing: 1px;
        flex-direction: column;
        align-items: center;
    }
    
    .pm-super {
        width: 80px;
        height: 65px;
        margin-top: -10px;
    }
    
    .pm-super::before {
        border-left: 40px solid transparent;
        border-right: 40px solid transparent;
        border-top: 65px solid #20558a;
    }
    
    .pm-super span {
        top: 15px;
        font-size: 0.8rem;
    }
    
    .prism-text {
        margin-left: 0;
        margin-top: 5px;
        font-size: 1.8rem;
    }
    
    .prism-subtitle {
        font-size: 0.8rem;
        text-align: center;
    }
    
    /* Filter panel */
    .filter-row {
        flex-direction: column;
    }
    
    .filter-column {
        min-width: 100%;
        padding: 0.5rem 0;
        border-bottom: 1px solid #E0E7FF;
    }
    
    .filter-column:last-child {
        border-bottom: none;
    }
    
    .prism-divider {
        display: none;
    }
    
    .filters-badge {
        position: static;
        margin-top: 1rem;
        text-align: center;
    }
    
    /* Cards and stats */
    .stat-card, .prism-card {
        padding: 1rem;
        clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    }
    
    .stat-number {
        font-size: 1.8rem;
    }
    
    /* Treatment cards grid */
    .treatment-cards-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .parallelogram-card {
        transform: skewX(-3deg);
        padding: 1rem;
    }
    
    .parallelogram-card:hover {
        transform: skewX(-3deg) translateY(-3px);
    }
    
    .parallelogram-card .card-content {
        transform: skewX(3deg);
    }
    
    .parallelogram-card .treatment-count {
        font-size: 1.5rem;
    }
    
    /* Articles layout - stack on mobile */
    .articles-container {
        flex-direction: column;
    }
    
    .articles-nav-panel {
        display: flex !important;
        flex-direction: row;
        width: 100%;
        min-width: 100%;
        gap: 0.5rem;
        padding: 0.75rem 0.5rem;
        order: -1;
        background: white;
        border: 1px solid #E0E7FF;
        border-radius: 4px;
        margin-bottom: 0.5rem;
    }
    
    .article-nav-btn {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
        font-size: 1rem;
    }
    
    .article-page-info {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .article-page-input {
        width: 40px;
        padding: 0.4rem;
        font-size: 0.85rem;
    }
    
    .article-page-total {
        font-size: 0.75rem;
    }
    
    .articles-list {
        flex: none;
        max-width: 100%;
        width: 100%;
    }
    
    .abstract-panel {
        flex: none;
        max-width: 100%;
        width: 100%;
        position: static;
        max-height: none;
        border-left: none;
        border-top: 2px solid #E0E7FF;
    }
    
    .abstract-panel-content {
        min-height: 200px;
    }
    
    .abstract-panel-placeholder {
        height: 150px;
        padding: 1rem;
    }
    
    /* Chart adjustments */
    .chart-container {
        height: 300px;
        padding: 1rem;
    }
    
    /* Article rows */
    .article-row {
        padding: 0.75rem;
    }
    
    .article-title {
        font-size: 0.9rem;
    }
    
    .article-meta-row {
        font-size: 0.75rem;
    }
    
    /* Pagination */
    .articles-pagination .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    /* Header buttons */
    .header-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .header-buttons .btn {
        font-size: 0.8rem;
        padding: 0.35rem 0.75rem;
    }
    
    /* Badges */
    .badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
    
    /* Selected filters summary */
    #selected-filters-summary .alert {
        font-size: 0.85rem;
        padding: 0.75rem;
    }
    
    /* Search input */
    .input-group-sm .form-control {
        font-size: 0.85rem;
    }
    
    /* Section headers */
    h4, h5 {
        font-size: 1.1rem;
    }
    
    /* Trending section title */
    .mesh-title {
        font-size: 1.3rem;
    }
}

/* Small devices (landscape phones, 576px to 767px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .prism-logo {
        font-size: 2rem;
    }
    
    .pm-super {
        width: 100px;
        height: 80px;
    }
    
    .pm-super::before {
        border-left: 50px solid transparent;
        border-right: 50px solid transparent;
        border-top: 80px solid #20558a;
    }
    
    .pm-super span {
        top: 20px;
        font-size: 0.9rem;
    }
    
    .filter-row {
        flex-wrap: wrap;
    }
    
    .filter-column {
        min-width: 45%;
        flex: 0 0 45%;
    }
    
    .treatment-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .articles-container {
        flex-direction: column;
    }
    
    .articles-nav-panel {
        display: flex !important;
        flex-direction: row;
        width: 100%;
        min-width: 100%;
        gap: 0.5rem;
        padding: 0.75rem 0.5rem;
        order: -1;
        background: white;
        border: 1px solid #E0E7FF;
        border-radius: 4px;
        margin-bottom: 0.5rem;
    }
    
    .article-nav-btn {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        font-size: 1.1rem;
    }
    
    .article-page-info {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .articles-list {
        flex: none;
        max-width: 100%;
    }
    
    .abstract-panel {
        flex: none;
        max-width: 100%;
        position: static;
        border-left: none;
        border-top: 2px solid #E0E7FF;
    }
    
    .chart-container {
        height: 350px;
    }
}

/* Medium devices (tablets, 768px to 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .filter-column {
        min-width: 30%;
        flex: 1;
    }
    
    .treatment-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .articles-container {
        flex-direction: row;
        gap: 0.75rem;
    }
    
    .articles-nav-panel {
        display: flex !important;
        width: auto !important;
        min-width: 70px;
        flex-direction: column;
        order: 0;
        background: white;
        border: 1px solid #E0E7FF;
        border-radius: 4px;
    }
    
    .articles-list {
        flex: 0 0 55%;
        max-width: 55%;
    }
    
    .abstract-panel {
        flex: 0 0 45%;
        max-width: 45%;
    }
    
    .parallelogram-card .treatment-count {
        font-size: 1.75rem;
    }
}

/* Large devices (desktops, 992px to 1199px) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .treatment-cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .articles-nav-panel {
        display: flex !important;
        width: auto !important;
        min-width: 70px;
        flex-direction: column;
        background: white;
        border: 1px solid #E0E7FF;
        border-radius: 4px;
    }
    
    .articles-list {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .abstract-panel {
        flex: 0 0 40%;
        max-width: 40%;
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .treatment-cards-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .article-row:hover {
        background: inherit;
    }
    
    .article-row.active {
        background: linear-gradient(135deg, #e0e7ff 0%, #fce7f3 100%);
    }
    
    .parallelogram-card:hover {
    }
    
    .parallelogram-card:active {
    }
    
    /* Larger touch targets */
    .form-check {
        padding: 0.5rem 0;
    }
    
    .form-check-input {
        width: 1.25rem;
        height: 1.25rem;
    }
    
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Print styles */
@media print {
    .dashboard-header {
        background: #333 !important;
        clip-path: none;
    }
    
    .filter-row,
    .articles-pagination,
    .save-article-btn,
    .save-treatment-btn,
    #selected-filters-summary {
        display: none !important;
    }
    
    .stat-card, .prism-card {
        clip-path: none;
        border: 1px solid #ccc;
    }
    
    .articles-container {
        display: block;
    }
    
    .articles-list,
    .abstract-panel {
        max-width: 100%;
        width: 100%;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .parallelogram-card:hover {
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .stat-card, .prism-card {
        border: 2px solid #000;
    }
    
    .article-row {
        border-bottom: 2px solid #000;
    }
    
    .badge {
        border: 1px solid currentColor;
    }
}

/* Dark mode support (optional - respects system preference) */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles if needed */
}
