/**
 * E-Journal Portal — Responsive Styles
 * Mobile, Tablet, and Desktop Breakpoints
 */

/* =====================================================
   CSS Variables for Public Views
   ===================================================== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #10b981;
    --accent: #06b6d4;
    --dark: #1e1b4b;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --border-color: #e2e8f0;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
    --text-primary: #1e293b;
    --bg-light: #f8fafc;
}

/* =====================================================
   Responsive Breakpoints
   ===================================================== */
/* Extra small (phones, < 576px) - default */
/* Small (landscape phones, 576px - 767px) */
/* Medium (tablets, 768px - 991px) */
/* Large (desktops, 992px - 1199px) */
/* Extra large (large desktops, >= 1200px) */

/* =====================================================
   Extra Small Devices (< 576px)
   ===================================================== */
@media (max-width: 575.98px) {
    /* Typography */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }

    /* Navbar */
    .navbar-custom {
        padding: 0.75rem 0;
    }
    .navbar-custom .brand {
        font-size: 1rem;
    }
    .navbar-custom .brand svg {
        width: 40px !important;
        height: 40px !important;
    }
    .navbar-custom .brand-subtitle {
        display: none !important;
    }
    .navbar-custom .btn-submit {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }

    /* Hero Section */
    .hero-section {
        padding: 3rem 0 4rem;
    }
    .hero-section .badge {
        font-size: 0.7rem;
        padding: 0.35rem 0.75rem;
    }
    .hero-section h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }
    .hero-section h1 br {
        display: none;
    }
    .hero-section > .container > .content > p {
        font-size: 0.9rem;
        padding: 0 0.5rem;
    }

    /* Search Box */
    .search-box {
        flex-direction: column;
        padding: 1rem;
        border-radius: 12px;
    }
    .search-box input {
        width: 100%;
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
        border-radius: 8px;
        margin-bottom: 0.75rem;
    }
    .search-box button {
        width: 100%;
        padding: 0.875rem 1.5rem;
        border-radius: 8px;
    }

    /* Hero Stats */
    .hero-stats {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
        padding: 0.5rem;
    }
    .hero-stats .stat {
        text-align: center;
        padding: 1rem 0.5rem;
    }
    .hero-stats .value {
        font-size: 1.5rem !important;
    }
    .hero-stats .label {
        font-size: 0.75rem;
    }

    /* Trust Bar */
    .trust-bar {
        padding: 1.5rem 0;
    }
    .trust-item {
        font-size: 0.7rem;
        padding: 0.4rem 0.6rem;
        margin: 0.25rem;
    }
    .trust-item i {
        font-size: 0.9rem;
        margin-right: 0.25rem;
    }

    /* Section Spacing */
    .py-section {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }

    /* Cards */
    .card-body {
        padding: 1rem;
    }
    .article-card .card-body {
        padding: 1rem;
    }
    .article-card .card-title {
        font-size: 1rem;
        line-height: 1.4;
    }

    /* Buttons */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    .btn-lg {
        padding: 0.625rem 1.25rem;
        font-size: 0.9375rem;
    }

    /* Grid Adjustments */
    .row > .col-12 {
        margin-bottom: 1rem;
    }

    /* Footer */
    .footer {
        padding: 2rem 0 1rem;
    }
    .footer h5 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    .footer ul li {
        margin-bottom: 0.4rem;
    }
    .footer .brand {
        font-size: 1rem;
    }
    .footer .desc {
        font-size: 0.85rem;
    }
    .footer .bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    /* Featured Articles */
    .featured-grid {
        grid-template-columns: 1fr !important;
    }

    /* Category Cards */
    .category-card {
        margin-bottom: 1rem;
    }

    /* CTA Section */
    .cta-section {
        padding: 2rem 1.5rem;
        text-align: center;
    }
    .cta-section h2 {
        font-size: 1.25rem;
    }
    .cta-section p {
        font-size: 0.9rem;
    }
    .cta-section .btn {
        width: 100%;
        margin-bottom: 0.75rem;
    }

    /* Article Detail */
    .article-meta {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .article-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    .article-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* Forms */
    .form-control, .form-select {
        font-size: 0.9rem;
        padding: 0.625rem 0.875rem;
    }
    .form-label {
        font-size: 0.875rem;
    }

    /* Tables */
    .table-responsive {
        font-size: 0.85rem;
    }

    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
    }
}

/* =====================================================
   Small Devices (576px - 767px)
   ===================================================== */
@media (min-width: 576px) and (max-width: 767.98px) {
    .hero-section h1 {
        font-size: 2rem;
    }
    .hero-stats {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
    }
    .search-box {
        max-width: 90%;
        margin: 0 auto;
    }
}

/* =====================================================
   Medium Devices (Tablets, 768px - 991px)
   ===================================================== */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* Navigation */
    .navbar-custom .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    /* Hero */
    .hero-section h1 {
        font-size: 2.25rem;
    }

    /* Grid */
    .featured-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Sidebar layouts */
    .content-with-sidebar {
        flex-direction: column;
    }
    .sidebar-aside {
        width: 100% !important;
        margin-top: 2rem;
    }
}

/* =====================================================
   Large Devices (Desktops, 992px - 1199px)
   ===================================================== */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .hero-section h1 {
        font-size: 2.5rem;
    }
}

/* =====================================================
   Extra Large Devices (Large Desktops, >= 1200px)
   ===================================================== */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

/* =====================================================
   Mobile Navigation Toggle
   ===================================================== */
.mobile-nav-toggle {
    display: none;
}

/* Show mobile nav on small screens */
@media (max-width: 991.98px) {
    .mobile-nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: transparent;
        border: 2px solid var(--primary);
        border-radius: 8px;
        color: var(--primary);
        cursor: pointer;
        transition: all 0.2s;
    }
    .mobile-nav-toggle:hover {
        background: var(--primary);
        color: white;
    }

    .desktop-nav {
        display: none !important;
    }

    .mobile-nav {
        display: block !important;
    }

    .mobile-nav-menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        background: white;
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
    }

    .mobile-nav-menu.active {
        transform: translateX(0);
    }

    .mobile-nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1049;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s;
    }

    .mobile-nav-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .mobile-nav-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
    }

    .mobile-nav-close {
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--bg-light);
        border: none;
        border-radius: 50%;
        cursor: pointer;
        font-size: 1.25rem;
    }

    .mobile-nav-links {
        padding: 1rem 0;
    }

    .mobile-nav-links a {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.875rem 1.25rem;
        color: var(--text-primary);
        font-weight: 500;
        transition: all 0.2s;
    }

    .mobile-nav-links a:hover,
    .mobile-nav-links a.active {
        background: var(--primary);
        color: white;
    }

    .mobile-nav-links a i {
        font-size: 1.1rem;
        width: 24px;
    }
}

/* =====================================================
   Utility Classes for Responsive
   ===================================================== */
.hide-mobile { display: block; }
.show-mobile { display: none; }

@media (max-width: 767.98px) {
    .hide-mobile { display: none !important; }
    .show-mobile { display: block !important; }
    .show-mobile-inline { display: inline !important; }
    .show-mobile-flex { display: flex !important; }
}

@media (min-width: 768px) {
    .show-tablet { display: block !important; }
    .show-tablet-inline { display: inline !important; }
}

@media (max-width: 991.98px) {
    .hide-tablet { display: none !important; }
}

@media (min-width: 992px) {
    .show-desktop { display: block !important; }
}

/* =====================================================
   Spacing Utilities
   ===================================================== */
@media (max-width: 767.98px) {
    .mb-sm-0 { margin-bottom: 0 !important; }
    .mb-sm-1 { margin-bottom: 0.25rem !important; }
    .mb-sm-2 { margin-bottom: 0.5rem !important; }
    .mb-sm-3 { margin-bottom: 1rem !important; }
    .mb-sm-4 { margin-bottom: 1.5rem !important; }
    .mb-sm-5 { margin-bottom: 3rem !important; }

    .mt-sm-0 { margin-top: 0 !important; }
    .mt-sm-3 { margin-top: 1rem !important; }
    .mt-sm-4 { margin-top: 1.5rem !important; }
    .mt-sm-5 { margin-top: 3rem !important; }

    .py-sm-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
    .py-sm-5 { padding-top: 3rem !important; padding-bottom: 3rem !important; }
}

/* =====================================================
   Image Responsive
   ===================================================== */
.img-fluid-mobile {
    max-width: 100%;
    height: auto;
}

@media (max-width: 575.98px) {
    .article-card img {
        height: 180px !important;
        object-fit: cover;
    }
}

/* =====================================================
   Scroll Horizontal on Mobile
   ===================================================== */
.horizontal-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.horizontal-scroll::-webkit-scrollbar {
    height: 6px;
}

.horizontal-scroll::-webkit-scrollbar-track {
    background: var(--bg-light);
}

.horizontal-scroll::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

/* =====================================================
   Print Styles
   ===================================================== */
@media print {
    .no-print,
    .navbar-custom,
    .footer,
    .btn,
    .article-actions,
    .mobile-nav-toggle {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .container {
        max-width: 100% !important;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}

/* =====================================================
   File Upload Zone Styles (Public Views)
   ===================================================== */
.file-drop-zone {
    border: 3px dashed var(--border, #e2e8f0);
    border-radius: 16px;
    padding: 3rem;
    text-align: center;
    transition: all 0.3s;
    background: var(--surface-alt, #f8fafc);
    cursor: pointer;
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
    border-color: var(--primary, #6366f1);
    background: rgba(99, 102, 241, 0.05);
}

.file-drop-zone.is-invalid {
    border-color: var(--danger, #ef4444);
}

.file-drop-zone input[type="file"] {
    display: block;
    opacity: 0;
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.file-drop-zone .file-drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.file-drop-zone .file-icon {
    font-size: 3rem;
    color: var(--primary, #6366f1);
    margin-bottom: 1rem;
}

.file-drop-zone .file-preview {
    background: var(--surface-alt, #f8fafc);
    border-radius: 10px;
    padding: 1rem;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Keywords Tags */
.keywords-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.keyword-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--primary, #6366f1);
    color: #fff;
    border-radius: 50px;
    font-size: 0.875rem;
    animation: chipIn 0.2s ease-out;
}

@keyframes chipIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.keyword-chip .remove {
    cursor: pointer;
    opacity: 0.7;
}

.keyword-chip .remove:hover {
    opacity: 1;
}

/* Info Box */
.info-box {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(99, 102, 241, 0.05));
    border-radius: 12px;
    padding: 1.5rem;
    border-left: 4px solid var(--primary, #6366f1);
}

.info-box h5 {
    color: var(--primary, #6366f1);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.info-box ul {
    margin: 0;
    padding-left: 1.25rem;
}

.info-box li {
    margin-bottom: 0.25rem;
}

/* Alert Styles */
.alert-success {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    border: none;
    border-radius: 12px;
    color: #065f46;
    padding: 1.5rem;
}

.alert-danger {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border: none;
    border-radius: 12px;
    color: #991b1b;
    padding: 1.5rem;
}
