/* 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: 8px 0 !important;
        background: rgba(10, 14, 23, 0.95) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    }

    .zink-nav {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0 16px !important;
        position: relative !important;
        width: 100% !important;
    }

    .zink-logo {
        position: static !important;
        transform: none !important;
        left: auto !important;
        font-size: 1.05rem !important;
        font-weight: 800 !important;
        margin: 0 !important;
        white-space: nowrap !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 8px !important;
        flex-shrink: 0 !important;
        z-index: 10 !important;
        padding-left: 2px !important;
    }

    .zink-logo i {
        font-size: 1.15rem !important;
    }

    .zink-nav .d-flex {
        display: inline-flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 6px !important;
        flex-shrink: 0 !important;
        width: auto !important;
    }

    .login-btn {
        padding: 5px 10px !important;
        font-size: 0.72rem !important;
        font-weight: 600 !important;
        border-radius: 50px !important;
        white-space: nowrap !important;
        letter-spacing: 0.5px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: auto !important;
    }

    .login-btn i {
        font-size: 0.72rem !important;
        margin-right: 4px !important;
    }

    .nav-menu-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.85rem !important;
        border-radius: 8px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
    }

    /* Hero Section on Mobile (Index / Homepage) */
    .hero {
        min-height: auto !important;
        padding: 50px 14px 30px !important;
    }

    .hero-title,
    .hero h1,
    .hero-content h1.display-3 {
        font-size: 1.55rem !important;
        line-height: 1.25 !important;
        letter-spacing: 0.5px !important;
        margin-bottom: 12px !important;
        text-shadow: 0 0 15px rgba(59, 130, 246, 0.4) !important;
    }

    .hero-subtitle,
    .hero h1 span,
    .hero-content h1 .display-6 {
        font-size: 0.82rem !important;
        letter-spacing: 2px !important;
        margin-bottom: 6px !important;
    }

    .hero-lead,
    .hero p,
    .hero-content p.lead {
        font-size: 0.82rem !important;
        line-height: 1.5 !important;
        max-width: 95% !important;
        margin: 0 auto 20px !important;
    }

    .hero-btn-group {
        display: flex !important;
        flex-direction: row !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 10px !important;
        max-width: 300px !important;
        margin: 0 auto !important;
        width: 100% !important;
    }

    .hero-btn-group .btn,
    .btn-hero-cta {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        padding: 9px 12px !important;
        font-size: 0.82rem !important;
        font-weight: 700 !important;
        border-radius: 50px !important;
        white-space: nowrap !important;
        text-align: center !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: none !important;
        width: auto !important;
    }

    .hover-card {
        padding: 14px !important;
        margin-bottom: 10px !important;
    }

    .hover-card h5 {
        font-size: 0.92rem !important;
    }

    .hover-card p {
        font-size: 0.78rem !important;
        line-height: 1.4 !important;
    }

    .step-card {
        padding: 16px 12px !important;
        margin-bottom: 12px !important;
    }

    .step-number {
        font-size: 1.3rem !important;
    }

    /* Fixing "Bhadda" (Ugly) Wrapping */
    .hero-section p,
    .tagline-text,
    .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;
    }

    /* Scoped Admin flex-direction column (keeps user front pages horizontal) */
    .content .d-flex.justify-content-between,
    .admin-card .d-flex.justify-content-between {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 15px;
    }

    .content .d-flex.justify-content-between>*,
    .admin-card .d-flex.justify-content-between>* {
        width: 100%;
    }

    /* Specific fix for Search forms/Buttons group */
    .d-flex.gap-2 {
        flex-wrap: wrap;
    }

    /* =========================================
       Tables -> Card View
       ========================================= */
    /* =========================================
       Tables -> Compact Scroll View
       ========================================= */
    .table-responsive {
        border: none;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Ensure table behaves like a table */
    .table thead {
        display: table-header-group !important;
    }

    .table tbody tr {
        display: table-row !important;
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        box-shadow: none !important;
    }

    .table tbody td {
        display: table-cell !important;
        text-align: left !important;
        border-bottom: 1px solid #333 !important;
        padding: 0.4rem !important;
        /* Compact padding */
        font-size: 0.75rem !important;
        /* Smaller text */
        white-space: normal;
        /* ALLOW wrapping on mobile */
        word-break: break-all;
    }

    .filename-cell div,
    .text-truncate {
        max-width: 120px !important;
        /* Smaller max-width on mobile */
        white-space: normal !important;
        word-break: break-all !important;
    }

    .table tbody td::before {
        display: none !important;
        /* Remove labels */
    }

    /* Header Font Size Reduction */
    .table thead th {
        font-size: 0.75rem !important;
        padding: 0.5rem !important;
        white-space: nowrap;
    }

    /* Actions Column Adjustment */
    .table tbody td:last-child {
        display: table-cell !important;
        margin: 0 !important;
        border: none !important;
        /* Reset specific border */
        border-bottom: 1px solid #333 !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 auto !important;
        max-width: calc(100% - 20px) !important;
    }

    /* User Profile Details Modal (Mobile View) */
    #userDetailsModal .modal-dialog {
        margin: 8px auto !important;
        width: calc(100% - 16px) !important;
        max-width: calc(100% - 16px) !important;
    }

    #userDetailsModal .modal-content {
        max-height: 92vh !important;
        display: flex !important;
        flex-direction: column !important;
        border-radius: 12px !important;
    }

    #userDetailsModal .modal-body {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 0 !important;
    }

    #userDetailsModal .user-modal-sidebar {
        width: 100% !important;
        min-width: 100% !important;
        border-right: none !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
        padding: 14px 12px !important;
    }

    #userDetailsModal .user-modal-sidebar .text-center {
        margin-bottom: 10px !important;
        padding-top: 0 !important;
    }

    #userDetailsModal .user-modal-sidebar img {
        width: 60px !important;
        height: 60px !important;
        margin-bottom: 6px !important;
    }

    #userDetailsModal .user-modal-nav {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 6px !important;
        width: 100% !important;
    }

    #userDetailsModal .user-modal-nav .nav-link {
        flex: 1 1 30% !important;
        text-align: center !important;
        padding: 8px 6px !important;
        font-size: 0.78rem !important;
        margin-bottom: 0 !important;
        border-radius: 6px !important;
        white-space: nowrap !important;
    }

    #userDetailsModal .user-modal-content {
        min-height: auto !important;
        padding: 14px 12px !important;
        width: 100% !important;
    }

    #userDetailsModal .form-check-label {
        white-space: nowrap !important;
        word-break: normal !important;
        overflow-wrap: normal !important;
    }

    #userDetailsModal .form-label {
        font-size: 0.72rem !important;
        margin-bottom: 4px !important;
    }

    #userDetailsModal .form-control {
        font-size: 0.85rem !important;
        padding: 8px 10px !important;
    }

    #userDetailsModal .btn {
        font-size: 0.85rem !important;
    }

    /* 8. Server Management Mirrors */
    .mirror-card {
        margin-bottom: 10px !important;
    }

    .mirror-header {
        padding: 10px 12px !important;
        gap: 8px !important;
    }

    .drag-handle {
        margin-right: 6px !important;
        padding: 2px !important;
        font-size: 0.85rem !important;
    }

    .transition-icon {
        margin-right: 8px !important;
        font-size: 0.8rem !important;
    }

    .mirror-icon {
        font-size: 1.05rem !important;
        margin-right: 6px !important;
    }

    .mirror-title {
        font-size: 0.85rem !important;
        margin-bottom: 0 !important;
        white-space: nowrap !important;
    }

    .mirror-slug-badge {
        display: none !important;
    }

    .pin-btn {
        font-size: 0.62rem !important;
        padding: 3px 6px !important;
        white-space: nowrap !important;
        display: inline-flex !important;
        align-items: center !important;
    }

    .pin-btn i {
        font-size: 0.6rem !important;
        margin-right: 3px !important;
    }

    .toggle-switch {
        width: 36px !important;
        height: 20px !important;
        flex-shrink: 0 !important;
    }

    .slider:before {
        height: 14px !important;
        width: 14px !important;
        left: 3px !important;
        bottom: 3px !important;
    }

    input:checked+.slider:before {
        transform: translateX(16px) !important;
    }

    .global-settings-title {
        font-size: 1.15rem !important;
        letter-spacing: 1px !important;
    }

    .auto-rotate-pill {
        padding: 6px 12px !important;
        margin-top: 4px !important;
    }

    .auto-rotate-text {
        font-size: 0.72rem !important;
        letter-spacing: 0.5px !important;
    }

    .mirror-body-left {
        padding: 14px 12px !important;
        border-right: none !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    .mirror-body-right {
        padding: 14px 12px !important;
    }

    .test-conn-btn {
        padding: 4px 8px !important;
        font-size: 0.75rem !important;
        white-space: nowrap !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;
    }
}