/* Mobile Responsive Styles for ZinkCloud */

/* =========================================
   Global Mobile Adjustments (Max-Width 768px)
   ========================================= */
@media (max-width: 768px) {

    /* =========================================
       Performance & Layout Fixes
       ========================================= */
    html,
    body {
        overflow-x: hidden !important;
        width: 100%;
        position: relative;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Disable heavy hero animation on mobile for performance */
    .hero::before {
        animation: none !important;
        background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 70%) !important;
        width: 100% !important;
        left: 0 !important;
        height: 100% !important;
        top: 0 !important;
    }

    /* Reduce blur load */
    .zink-header {
        backdrop-filter: blur(10px) !important;
        /* Reduced from 20px */
        padding: 5px 0 !important;
    }

    /* Fix Hero Spacing */
    .hero {
        padding-top: 100px !important;
        padding-bottom: 40px !important;
        min-height: auto !important;
        /* Allow content to dictate height */
    }

    /* Typography Overrides */
    h1.display-3 {
        font-size: 2rem !important;
        /* Fix Home Hero Text */
    }

    h2 {
        font-size: 1.5rem !important;
    }

    .hero-content h1 span {
        font-size: 1.5rem !important;
    }

    /* Prevent horizontal overflow from long texts */
    * {
        overflow-wrap: break-word !important;
        word-break: break-word !important;
    }

    .file-title,
    .copy-input,
    .text-truncate {
        word-break: break-all !important;
    }

    /* =========================================
       Sidebar & Layout
       ========================================= */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        z-index: 1050;
        /* Above everything */
        width: 250px;
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.5);
    }

    .content {
        margin-left: 0 !important;
        /* Full width content */
        padding: 5px !important;
        /* Edge to Edge */
        padding-top: 60px !important;
        /* Space for toggle button */
    }

    /* Sidebar Toggle Button Positioning */
    .sidebar-toggle {
        display: block !important;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1060;
        /* Above sidebar */
        background: var(--zm-accent-primary, #3b82f6);
        color: white;
        border: none;
        border-radius: 5px;
        padding: 8px 12px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    }

    /* Universal Header Alignment */
    .zink-header {
        padding: 5px 0 !important;
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
    }

    .zink-nav {
        display: flex !important;
        flex-direction: row !important;
        justify-content: flex-end !important;
        align-items: center !important;
        padding: 5px 8px !important;
    }

    /* Fixing "Bhadda" (Ugly) Wrapping */
    .hero-section p,
    .tagline-text,
    .lead,
    .text-muted {
        font-size: 0.8rem !important;
        line-height: 1.4 !important;
        max-width: 95% !important;
        margin: 0 auto !important;
    }

    .server-name,
    .servers-header,
    h5,
    .card-title {
        font-size: 0.85rem !important;
        white-space: nowrap !important;
    }

    /* Specific Mobile Navbar Adjustments */
    .zink-logo {
        font-size: 1.28rem !important;
        /* ~2% larger than desktop 1.25rem */
    }

    .login-btn {
        padding: 6px 12px !important;
        font-size: 0.75rem !important;
        z-index: 100 !important;
        display: flex !important;
        background: var(--zm-accent-primary) !important;
        border: none !important;
    }

    /* =========================================
       Flex Containers (Headers, Toolbars)
       ========================================= */
    .d-flex.justify-content-between {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 15px;
    }

    .d-flex.justify-content-between>* {
        width: 100%;
        /* Full width items */
    }

    /* Specific fix for Search forms/Buttons group */
    .d-flex.gap-2 {
        flex-wrap: wrap;
    }

    /* Index/Home Header Menu */
    .zink-nav .d-flex {
        display: flex !important;
        /* Show buttons on mobile as requested */
        gap: 8px !important;
    }

    .login-btn {
        padding: 6px 10px !important;
        font-size: 0.7rem !important;
    }

    /* =========================================
       Tables -> Card View
       ========================================= */
    /* =========================================
       Tables -> Compact Scroll View Fix
       ========================================= */
    .table-responsive {
        border: none;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        display: block;
    }

    .table {
        white-space: nowrap !important; /* Keep columns from crushing */
    }

    .table tbody td {
        padding: 0.5rem !important;
        font-size: 0.8rem !important;
        border-bottom: 1px solid rgba(255,255,255,0.05) !important;
    }

    /* Actions Column Adjustment */
    .table tbody td:last-child {
        border-bottom: 1px solid rgba(255,255,255,0.05) !important;
    }

    /* =========================================
       User Management Specifics
       ========================================= */
    /* User Details (Avatar + Name) */
    .table tbody tr td:first-child {
        display: flex;
        align-items: center;
        grid-column: 1 / -1;
    }

    /* =========================================
       Dashboard & Admin Specifics
       ========================================= */

    .admin-card {
        padding: 5px !important;
        /* Extremely compact */
        margin-top: 8px !important;
        border-radius: 8px !important;
        width: 100% !important;
    }

    .admin-card-header h2 {
        font-size: 0.85rem !important;
        padding-bottom: 8px !important;
        margin-bottom: 12px !important;
    }

    .container-fluid {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* API Doc Code Blocks */
    pre[class*="language-"],
    code {
        font-size: 0.7rem !important;
        padding: 10px !important;
        border-radius: 5px !important;
    }

    .api-key-box {
        padding: 10px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .api-key-value {
        font-size: 0.9rem !important;
    }

    /* 1. Header Text Reduction */
    .d-flex.justify-content-between h3.mb-0.text-white.fw-bold {
        font-size: 1.1rem !important;
        /* Much smaller */
        line-height: 1.2;
    }

    .d-flex.justify-content-between p.text-muted.small {
        font-size: 0.6rem !important;
        letter-spacing: 1px !important;
        margin-top: 5px;
        line-height: 1.4;
    }

    /* 2. Stats Grid (2 Columns) */
    .stats-container {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    /* Make the last odd item span full width if needed, or just let it consist */
    .stats-container .status-card:last-child:nth-child(odd) {
        grid-column: span 2;
    }

    /* 3. Card Styling for Mobile (Strict Compactness) */
    .status-card {
        padding: 5px 8px !important;
        /* Extremely reduced padding */
        min-height: 50px !important;
        /* Very small height */
        display: flex !important;
        align-items: center !important;
        border-radius: 8px !important;
        margin-bottom: 0 !important;
    }

    .stats-container {
        gap: 8px !important;
        /* Tighter grid gaps */
        margin-bottom: 15px !important;
    }

    .status-info {
        width: 100% !important;
    }

    .status-info h3 {
        font-size: 0.5rem !important;
        /* Tiny Label */
        color: rgba(255, 255, 255, 0.5) !important;
        margin-bottom: 0 !important;
        letter-spacing: 0.3px !important;
    }

    .status-info p {
        font-size: 1rem !important;
        /* Compact Number */
        font-weight: 800;
        margin: 0 !important;
        line-height: 1 !important;
    }

    .stat-label {
        font-size: 0.5rem !important;
    }

    .stat-value {
        font-size: 0.85rem !important;
    }

    .stat-divider {
        margin: 3px 0 !important;
    }

    .stats-card-compact {
        min-height: 50px !important;
        padding: 5px 8px !important;
    }

    /* Partitioned Clicks Card Specific Fix */
    .status-info .d-flex.justify-content-between {
        flex-direction: row !important;
        align-items: center !important;
    }

    .status-info .d-flex span.fw-bold {
        font-size: 0.95rem !important;
    }

    .status-info div[style*="height: 1px"] {
        margin: 4px 0 !important;
        /* Tighten the line */
    }

    .status-card .status-icon {
        display: none !important;
        /* Hide icon to save space if present */
    }

    /* 4. Sidebar Toggle & Header Spacing */
    .content {
        padding-top: 5px !important;
        /* Align content closer to edge */
    }

    /* 5. Section Headers */
    .mb-5 h4,
    .mb-4 h2,
    .mb-4 h4 {
        font-size: 0.9rem !important;
        margin-bottom: 10px !important;
    }

    /* 6. Forms */
    .input-group text,
    .input-group input,
    .input-group button {
        font-size: 0.8rem !important;
        padding: 6px 10px !important;
    }

    /* 7. Modal Adjustments */
    .modal-dialog {
        margin: 10px !important;
    }

    /* 8. Server Management Mirrors */
    .mirror-card {
        margin-bottom: 10px !important;
    }

    /* 9. Chat Specifics */
    .chat-layout {
        height: calc(100vh - 160px) !important;
        gap: 10px !important;
    }

    .chat-main {
        border-radius: 12px !important;
    }

    .msg-bubble {
        padding: 10px 14px !important;
        font-size: 0.85rem !important;
    }

    .chat-input-area {
        padding: 10px !important;
        gap: 8px !important;
    }

    .chat-input {
        padding: 10px 15px !important;
        height: 45px !important;
        font-size: 0.85rem !important;
    }

    .btn-send {
        width: 40px !important;
        height: 40px !important;
        font-size: 1rem !important;
    }

    /* 10. Platform Settings Compactness */
    .settings-card {
        padding: 12px 15px !important;
        margin-bottom: 15px !important;
    }

    .settings-card .card-title {
        font-size: 0.95rem !important;
        margin-bottom: 12px !important;
        padding-bottom: 8px !important;
    }

    .status-toggle {
        padding: 8px 10px !important;
        margin-bottom: 8px !important;
    }

    .status-toggle .text-white.small.fw-bold {
        font-size: 0.75rem !important;
    }

    .status-toggle .help-text {
        font-size: 0.65rem !important;
    }

    .ad-row label {
        font-size: 0.75rem !important;
    }

    textarea.form-control {
        min-height: 60px !important;
        font-size: 0.75rem !important;
    }

    .btn-save {
        padding: 8px !important;
        font-size: 0.85rem !important;
    }
}