/* Mobile Responsive Styles for Backup GUI */

/* Mobile Navigation Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 70px;
    right: 15px;
    z-index: 10001;
    background: var(--primary-color, #4a90e2);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Mobile menu backdrop */
.mobile-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

.mobile-backdrop.active {
    display: block;
}

/* Tablet and Mobile Styles */
@media screen and (max-width: 1024px) {
    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: block !important;
    }

    /* Adjust top navigation */
    .top-nav {
        padding: 10px 15px;
        position: sticky;
        top: 0;
        z-index: 999;
    }

    .nav-brand span {
        font-size: 16px;
    }

    /* Make sidebar overlay on mobile */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        height: 100% !important;
        width: 250px !important;
        z-index: 9999 !important;
        background: var(--sidebar-bg) !important;
        overflow-y: auto !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s ease !important;
        box-shadow: 2px 0 10px rgba(0,0,0,0.3) !important;
    }

    .sidebar.active {
        transform: translateX(0) !important;
        display: block !important;
    }

    /* Adjust main content */
    .main-content {
        margin-left: 0;
        padding: 15px;
    }

    /* Make cards stack on mobile */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 10px;
    }

    /* Adjust tables for mobile */
    .data-table {
        font-size: 14px;
    }

    .data-table th,
    .data-table td {
        padding: 8px;
    }

    /* Make forms responsive */
    .form-row {
        flex-direction: column;
    }

    .form-group {
        margin-bottom: 15px;
    }

    /* Adjust buttons */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        width: 100%;
        margin: 5px 0;
    }

    /* Modal adjustments */
    .modal-content {
        width: 95%;
        max-width: 500px;
        margin: 20px auto;
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Small Mobile Styles */
@media screen and (max-width: 480px) {
    /* Further reduce padding */
    .top-nav {
        padding: 8px 10px;
        padding-left: 50px;
    }

    .nav-brand span {
        font-size: 14px;
        display: none; /* Hide text, show icon only */
    }

    .nav-brand i {
        font-size: 20px;
    }

    /* Hide status text on very small screens */
    .nav-status .status-indicator span:last-child {
        display: none;
    }

    .nav-user span {
        display: none;
    }

    /* Adjust card padding */
    .card {
        padding: 15px;
    }

    .card-header h2 {
        font-size: 18px;
    }

    /* Make tables scrollable */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 500px;
    }

    /* Stack form elements */
    .form-inline {
        flex-direction: column;
    }

    .form-inline > * {
        width: 100%;
        margin-bottom: 10px;
    }

    /* Adjust stat cards */
    .stat-card {
        padding: 10px;
    }

    .stat-value {
        font-size: 20px;
    }

    /* Notification settings checkboxes */
    .notification-events {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* File browser adjustments */
    .file-tree {
        font-size: 14px;
    }

    .file-tree-item {
        padding: 8px;
    }

    /* Progress bars */
    .progress-info {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Backup type buttons */
    .backup-types {
        grid-template-columns: 1fr;
    }

    /* Settings sections */
    .settings-section {
        padding: 15px;
    }

    /* Toast notifications */
    .toast {
        width: calc(100% - 20px);
        left: 10px;
        right: 10px;
    }
}

/* Touch-friendly adjustments */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn {
        min-height: 44px;
        padding: 12px 20px;
    }

    .nav-item {
        min-height: 48px;
    }

    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
    }

    .data-table tr {
        min-height: 44px;
    }

    /* Remove hover effects on touch devices */
    .btn:hover {
        transform: none;
    }

    .card:hover {
        transform: none;
        box-shadow: none;
    }
}

/* Landscape orientation adjustments */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .top-nav {
        position: sticky;
        top: 0;
        z-index: 999;
    }

    .sidebar {
        top: 50px;
        height: calc(100% - 50px);
    }

    .main-content {
        padding-top: 10px;
    }
}


/* Print styles */
@media print {
    .sidebar,
    .mobile-menu-toggle,
    .btn,
    .nav-status {
        display: none !important;
    }

    .main-content {
        margin: 0;
        padding: 0;
    }

    .card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Ensure forms are usable on mobile */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    font-size: 16px; /* Prevents zoom on iOS */
    width: 100%;
}

/* Scrollbar styling for mobile */
@media screen and (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 5px;
        height: 5px;
    }
}

/* Loading states for mobile */
.mobile-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    font-size: 14px;
    color: #666;
}

/* Responsive utilities */
.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

@media screen and (max-width: 768px) {
    .hide-mobile {
        display: none;
    }

    .show-mobile {
        display: block;
    }
}