/* Mobile-Responsive Styles for Private Raider */

/* Base Mobile Styles */
@media (max-width: 768px) {
    /* Body and Container Adjustments */
    body {
        font-size: 14px;
        padding: 0;
        margin: 0;
    }

    .main-wrap {
        padding: 10px;
        margin: 0;
    }

    /* Navigation Bar */
    .navbar {
        margin: 10px;
        border-radius: 8px;
        padding: 12px 15px;
    }

    .navbar ul {
        flex-wrap: wrap;
        gap: 8px;
    }

    .navbar li {
        font-size: 13px;
    }

    .navbar a {
        padding: 8px 12px;
    }

    /* Form Cards */
    .form-wrap {
        padding: 15px;
    }

    .form-card {
        max-width: 100%;
        padding: 20px 15px;
        margin: 0;
        border-radius: 8px;
    }

    .form-card h1 {
        font-size: 24px;
        margin-bottom: 10px;
    }

    .form-card h2 {
        font-size: 20px;
    }

    /* Form Elements */
    .form-group {
        margin-bottom: 15px;
    }

    .form-input,
    .form-select,
    select,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 12px 14px !important;
        width: 100%;
        box-sizing: border-box;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    /* Buttons */
    .btn,
    .btn-primary,
    .btn-secondary,
    .btn-outline {
        width: 100%;
        padding: 14px 20px;
        font-size: 16px;
        margin-bottom: 10px;
        box-sizing: border-box;
    }

    /* LFR Post Cards */
    .lfr-post-card,
    .raid-card {
        padding: 15px;
        margin-bottom: 15px;
        border-radius: 8px;
    }

    .lfr-post-card h3 {
        font-size: 18px;
        margin-bottom: 10px;
    }

    /* Filter Bar */
    .filter-bar {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }

    .filter-bar select,
    .filter-bar input {
        width: 100%;
        margin-bottom: 8px;
    }

    /* Character Cards */
    .character-card {
        padding: 12px;
        margin-bottom: 12px;
    }

    /* SR (Soft Reserve) Items */
    .sr-item-card {
        padding: 12px;
        font-size: 14px;
    }

    /* Tables - Make them scrollable on mobile */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 13px;
    }

    table th,
    table td {
        padding: 8px 6px;
        white-space: nowrap;
    }

    /* Hide certain columns on mobile */
    .hide-mobile {
        display: none !important;
    }

    /* Modals */
    .modal-content {
        width: 95%;
        max-width: 95%;
        padding: 20px 15px;
        margin: 10px auto;
    }

    /* Profile Page */
    .profile-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .profile-stats {
        flex-direction: column;
    }

    /* Dashboard */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .dashboard-card {
        padding: 15px;
    }

    /* Spacing Adjustments */
    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 20px;
    }

    h3 {
        font-size: 18px;
    }

    p {
        font-size: 14px;
        line-height: 1.5;
    }

    /* Touch-Friendly Click Areas */
    a,
    button {
        min-height: 44px; /* iOS recommended touch target */
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Discord Button */
    .discord-login-btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 16px;
    }
}

/* Extra Small Devices (phones in portrait, less than 375px) */
@media (max-width: 374px) {
    .form-card {
        padding: 15px 10px;
    }

    .navbar {
        margin: 5px;
        padding: 10px;
    }

    .btn,
    .btn-primary,
    .btn-secondary {
        font-size: 14px;
        padding: 12px 16px;
    }

    table {
        font-size: 12px;
    }

    table th,
    table td {
        padding: 6px 4px;
    }
}

/* Tablet Devices (768px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .main-wrap {
        padding: 20px;
    }

    .form-card {
        max-width: 600px;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Landscape Mobile Devices */
@media (max-height: 500px) and (orientation: landscape) {
    .navbar {
        padding: 8px 12px;
    }

    .form-card {
        padding: 15px;
    }

    .form-group {
        margin-bottom: 10px;
    }

    .btn {
        padding: 10px 16px;
    }
}

/* iOS Safe Areas (for notched devices like iPhone X+) */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }

    .navbar {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }

    .form-wrap {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }
}

/* Fix iOS input zoom */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    select,
    textarea,
    input {
        font-size: 16px !important;
    }
}

/* Improve touch scrolling on iOS */
.scrollable {
    -webkit-overflow-scrolling: touch;
}

/* Hide desktop-only elements on mobile */
@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }
}

/* Show desktop elements on desktop */
@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }

    .desktop-only {
        display: block !important;
    }
}

/* Mobile-friendly SR Grid */
@media (max-width: 768px) {
    .sr-grid {
        grid-template-columns: 1fr;
    }

    .sr-item {
        padding: 10px;
    }
}

/* Mobile Navigation Hamburger Menu (if needed) */
@media (max-width: 768px) {
    .nav-mobile-toggle {
        display: block;
        background: transparent;
        border: none;
        color: #fff;
        font-size: 24px;
        cursor: pointer;
        padding: 10px;
    }

    .navbar ul.mobile-collapsed {
        display: none;
    }

    .navbar ul.mobile-expanded {
        display: flex;
        flex-direction: column;
        width: 100%;
    }
}

/* Fixed Bottom Navigation for Mobile (optional) */
@media (max-width: 768px) {
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #101639 0%, #0d1028 100%);
        border-top: 2px solid #1a2847;
        display: flex;
        justify-content: space-around;
        padding: 10px 0;
        z-index: 1000;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.5);
    }

    .mobile-bottom-nav a {
        flex: 1;
        text-align: center;
        padding: 8px;
        color: #9aa2ba;
        text-decoration: none;
        font-size: 12px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }

    .mobile-bottom-nav a.active {
        color: #c79c6e;
    }

    .mobile-bottom-nav-icon {
        font-size: 20px;
    }

    /* Add padding to body when bottom nav is present */
    body.has-bottom-nav {
        padding-bottom: 70px;
    }
}

/* Character Switcher Dropdown - Mobile Friendly */
@media (max-width: 768px) {
    .character-switcher-dropdown {
        position: fixed;
        top: 60px;
        left: 10px;
        right: 10px;
        max-height: 70vh;
        overflow-y: auto;
        background: linear-gradient(135deg, #101639 0%, #0d1028 100%);
        border: 2px solid #1a2847;
        border-radius: 8px;
        padding: 10px;
        z-index: 9999;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    }
}

/* Loading Spinner - Mobile Optimized */
.loading-spinner {
    border: 3px solid #1a2847;
    border-top: 3px solid #c79c6e;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast Notifications - Mobile Position */
@media (max-width: 768px) {
    .toast-notification {
        bottom: 80px; /* Above bottom nav if present */
        left: 10px;
        right: 10px;
        width: auto;
    }
}

/* Prevent text selection on buttons (better mobile UX) */
button,
.btn,
.btn-primary,
.btn-secondary,
.btn-outline {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* Improve tap highlight on mobile */
a,
button,
input,
select,
textarea {
    -webkit-tap-highlight-color: rgba(199, 156, 110, 0.2);
}
