/* ============================================================
   ADMIN LAYOUT RESPONSIVE STYLES
   ============================================================ */

/* Mobile & Tablet - Show hamburger menu */
@media (max-width: 1024px) {
    .mobile-menu-btn {
        display: flex !important;
    }

    .navbar-vertical {
        left: -100%;
        width: min(280px, 85vw);
        transition: left 0.3s ease-in-out;
        z-index: 999;
    }

    .navbar-vertical.mobile-open {
        left: 0;
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    }

    .content-wrapper {
        margin-left: 0;
        width: 100%;
    }

    .content {
        padding: clamp(16px, 4vw, 24px);
        padding-top: clamp(70px, 12vw, 90px);
        margin-top: 0;
    }

    .sidebar-overlay {
        display: block !important;
        z-index: 98;
    }
}

/* Tablets */
@media (max-width: 768px) {
    .navbar-brand {
        padding: clamp(16px, 3vw, 20px);
        font-size: clamp(14px, 3vw, 16px);
    }

    .nav-link {
        padding: clamp(10px, 2vw, 12px) clamp(16px, 3vw, 20px);
        font-size: clamp(12px, 2vw, 14px);
    }

    .content {
        padding: clamp(12px, 3vw, 16px);
    }
}

/* Small phones */
@media (max-width: 575px) {
    .mobile-menu-btn {
        top: 12px;
        left: 12px;
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .navbar-brand {
        padding: clamp(12px, 2.5vw, 16px);
        font-size: clamp(12px, 2.5vw, 14px);
    }

    .nav-link {
        padding: clamp(8px, 2vw, 10px) clamp(12px, 2.5vw, 16px);
        font-size: clamp(11px, 1.8vw, 12px);
    }

    .nav-link span:last-child {
        display: none;
    }

    .content {
        padding: clamp(8px, 2vw, 12px);
        padding-top: clamp(60px, 10vw, 70px);
    }
}

/* ============================================================
   RESPONSIVE DESIGN - Mobile First Approach
   ============================================================ */

:root {
    --primary-color: #0B3D91;
    --secondary-color: #0F9D58;
    --accent-color: #00E5FF;
    --background-color: #0A0F1C;
    --card-background: #0F1724;
    --text-default: #FFFFFF;
    --text-muted: #B9C2D9;
    --error-color: #ff6b6b;
    --success-color: #0F9D58;
    --warning-color: #FFC107;
    --sidebar-width: 250px;
    --mobile-menu-height: 60px;
}

/* ============================================================
   UNIVERSAL MOBILE OPTIMIZATION
   ============================================================ */

* {
    -webkit-tap-highlight-color: transparent;
}

button, a, .btn, .nav-link, label, .sidebar-menu, .mobile-menu-btn {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

input, textarea, select, p, span, h1, h2, h3, h4, h5, h6, td, th, li, div {
    -webkit-user-select: text;
    user-select: text;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    background-color: var(--background-color);
    color: var(--text-default);
}

/* ============================================================
   TOUCH OPTIMIZATION
   ============================================================ */

button, a, input[type="button"], input[type="submit"], 
.btn, .nav-link, label {
    min-height: 44px;
    min-width: 44px;
    padding: clamp(8px, 2vw, 12px) clamp(12px, 3vw, 24px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select {
    min-height: 44px;
    min-width: 44px;
    padding: clamp(10px, 2.5vw, 15px);
    font-size: 16px;
}

/* ============================================================
   RESPONSIVE TYPOGRAPHY
   ============================================================ */

h1 {
    font-size: clamp(24px, 6vw, 40px);
    margin: clamp(12px, 3vw, 24px) 0;
}

h2 {
    font-size: clamp(20px, 5vw, 32px);
    margin: clamp(10px, 2.5vw, 20px) 0;
}

h3 {
    font-size: clamp(18px, 4vw, 28px);
    margin: clamp(8px, 2vw, 16px) 0;
}

h4 {
    font-size: clamp(16px, 3.5vw, 24px);
    margin: clamp(6px, 1.5vw, 12px) 0;
}

h5, h6 {
    font-size: clamp(14px, 3vw, 18px);
    margin: clamp(4px, 1vw, 8px) 0;
}

p {
    font-size: clamp(14px, 2vw, 16px);
    line-height: 1.6;
}

/* ============================================================
   MOBILE DEVICES (< 576px)
   ============================================================ */

@media (max-width: 575px) {
    .admin-container {
        flex-direction: column;
    }

    /* Tables on mobile */
    table {
        width: 100%;
        font-size: 12px;
    }

    table thead {
        display: none;
    }

    table tbody, table tr, table td {
        display: block;
        width: 100%;
    }

    table tr {
        margin-bottom: 15px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        overflow: hidden;
        padding: 10px;
    }

    table td {
        text-align: right;
        padding-left: 50%;
        position: relative;
        border: none;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    table td::before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        font-weight: 600;
        color: var(--accent-color);
        text-align: left;
    }

    /* Forms on mobile */
    .form-group {
        margin-bottom: clamp(12px, 3vw, 16px);
    }

    .form-label {
        margin-bottom: clamp(6px, 1.5vw, 10px);
        font-size: clamp(12px, 2vw, 14px);
    }

    .form-control, select, textarea {
        width: 100%;
        margin-bottom: clamp(8px, 2vw, 12px);
        font-size: 16px;
        border-radius: 8px;
    }

    /* Cards on mobile */
    .card {
        margin-bottom: clamp(12px, 3vw, 16px);
        border-radius: 8px;
        padding: clamp(12px, 3vw, 16px);
    }

    /* Grid layouts on mobile */
    .row {
        grid-template-columns: 1fr;
        gap: clamp(10px, 2vw, 16px);
    }

    .row.row-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .row.row-3 {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }

    .row.row-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Buttons on mobile */
    .btn {
        width: 100%;
        font-size: clamp(12px, 2vw, 14px);
        padding: clamp(10px, 2vw, 12px);
        border-radius: 6px;
    }

    .btn-group {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .btn-group .btn {
        width: 100%;
    }

    /* Alerts on mobile */
    .alert {
        padding: clamp(10px, 2vw, 16px);
        margin-bottom: clamp(12px, 3vw, 16px);
        border-radius: 6px;
        font-size: clamp(12px, 2vw, 14px);
    }

    /* Badges on mobile */
    .badge {
        padding: 4px 8px;
        font-size: 11px;
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Lists on mobile */
    .list-group-item {
        padding: clamp(10px, 2vw, 16px);
        min-height: 44px;
    }

    /* Safe area for notched devices */
    body {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-top: max(12px, env(safe-area-inset-top));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}

/* ============================================================
   SMALL TABLETS (576px - 768px)
   ============================================================ */

@media (min-width: 576px) and (max-width: 768px) {
    .row {
        grid-template-columns: repeat(2, 1fr);
    }

    .row.row-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .row.row-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Tables with scroll on tablet */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 13px;
    }

    /* Forms on tablet */
    .form-control, select, textarea {
        font-size: 16px;
    }

    /* Buttons */
    .btn {
        font-size: 13px;
        padding: clamp(8px, 1.5vw, 12px) clamp(12px, 2vw, 16px);
    }
}

/* ============================================================
   LARGE TABLETS & SMALL DESKTOP (769px - 1024px)
   ============================================================ */

@media (min-width: 769px) and (max-width: 1024px) {
    .row {
        grid-template-columns: repeat(3, 1fr);
    }

    .row.row-4 {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Tables */
    table {
        font-size: 14px;
    }

    /* Forms */
    .form-control, select, textarea {
        font-size: 15px;
    }

    /* Buttons */
    .btn {
        font-size: 14px;
    }
}

/* ============================================================
   DESKTOP (> 1024px)
   ============================================================ */

@media (min-width: 1025px) {
    .row {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }

    .row.row-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .row.row-4 {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Tables full size */
    table {
        font-size: 14px;
    }

    /* Forms */
    .form-control, select, textarea {
        font-size: 16px;
    }

    /* Buttons */
    .btn {
        font-size: 14px;
    }

    /* Hover effects only on desktop */
    .card {
        transition: all 0.2s ease;
    }

    .card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 229, 255, 0.2);
    }

    button:not(:disabled):hover {
        opacity: 0.9;
    }

    a:hover {
        opacity: 0.8;
    }
}

/* ============================================================
   ULTRA-WIDE DISPLAYS (> 1400px)
   ============================================================ */

@media (min-width: 1400px) {
    .content {
        max-width: 1400px;
        margin: 0 auto;
    }

    .row {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    }
}

/* ============================================================
   LANDSCAPE ORIENTATION
   ============================================================ */

@media (max-height: 500px) and (orientation: landscape) {
    .navbar-vertical {
        height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .content {
        padding: clamp(12px, 2vw, 16px);
    }

    h1 {
        font-size: 20px;
    }

    h2 {
        font-size: 18px;
    }

    .form-control, select, textarea, button {
        min-height: 40px;
    }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */

@media print {
    .mobile-menu-btn,
    .sidebar-overlay,
    .navbar-vertical,
    .nav-link,
    .btn {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .content-wrapper {
        margin-left: 0;
    }

    .content {
        padding: 0;
    }

    table {
        page-break-inside: avoid;
    }

    tr {
        page-break-inside: avoid;
    }
}

/* ============================================================
   HIGH DPI DISPLAYS (Retina, 2x+)
   ============================================================ */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body {
        -webkit-font-smoothing: subpixel-antialiased;
    }
}

/* ============================================================
   DARK MODE (System preference)
   ============================================================ */

@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #0A0F1C;
        --card-background: #0F1724;
        --text-default: #FFFFFF;
        --text-muted: #B9C2D9;
    }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */

.d-none {
    display: none;
}

.d-block {
    display: block;
}

.d-flex {
    display: flex;
}

.flex-column {
    flex-direction: column;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.gap-3 {
    gap: 1.5rem;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.text-danger {
    color: var(--error-color);
}

.text-success {
    color: var(--success-color);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 229, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 229, 255, 0.4);
}


