/* EARNINGSPHERE Mobile-First Responsive Styles */
/* Apply these styles to all pages for consistent mobile experience */

/* Base Mobile-First Styles */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow text selection for inputs and content areas */
input, textarea, .selectable-text, p, h1, h2, h3, h4, h5, h6 {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Mobile Viewport and Touch Optimization */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    touch-action: manipulation;
}

body {
    font-size: 16px; /* Prevent zoom on iOS */
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Mobile Container Styles */
.mobile-container {
    max-width: 100%;
    padding: 1rem;
    margin: 0 auto;
}

/* Mobile Navigation */
.mobile-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(128, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.mobile-nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
}

.mobile-logo {
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    text-decoration: none;
}

.mobile-menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: rgba(128, 0, 0, 0.98);
    backdrop-filter: blur(15px);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    z-index: 999;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
}

.mobile-menu.active {
    transform: translateY(0);
}

.mobile-menu-item {
    display: block;
    color: white;
    text-decoration: none;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background 0.3s ease;
}

.mobile-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Mobile Form Styles */
.mobile-form {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 1rem;
}

.mobile-form-group {
    margin-bottom: 1.5rem;
}

.mobile-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.mobile-form-group input,
.mobile-form-group textarea,
.mobile-form-group select {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 16px; /* Prevent zoom on iOS */
    background: white;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.mobile-form-group input:focus,
.mobile-form-group textarea:focus,
.mobile-form-group select:focus {
    outline: none;
    border-color: #800000;
    box-shadow: 0 0 0 3px rgba(128, 0, 0, 0.1);
}

/* Mobile Button Styles */
.mobile-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 48px; /* Touch target size */
    margin-bottom: 1rem;
}

.mobile-btn-primary {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    box-shadow: 0 4px 15px rgba(238, 90, 36, 0.3);
}

.mobile-btn-primary:hover,
.mobile-btn-primary:active {
    background: linear-gradient(135deg, #ee5a24, #ff6b6b);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(238, 90, 36, 0.4);
}

.mobile-btn-secondary {
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: white;
    box-shadow: 0 4px 15px rgba(116, 185, 255, 0.3);
}

.mobile-btn-outline {
    background: transparent;
    color: #800000;
    border: 2px solid #800000;
}

/* Mobile Card Styles */
.mobile-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.mobile-card-header {
    margin-bottom: 1rem;
    text-align: center;
}

.mobile-card-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 0.5rem;
}

.mobile-card-subtitle {
    color: #666;
    font-size: 0.9rem;
}

/* Mobile Grid System */
.mobile-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

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

/* Mobile Stats Cards */
.mobile-stat-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.mobile-stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.mobile-stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.mobile-stat-label {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Mobile Alert Styles */
.mobile-alert {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-weight: 500;
}

.mobile-alert-success {
    background: rgba(0, 184, 148, 0.1);
    color: #00b894;
    border: 1px solid rgba(0, 184, 148, 0.2);
}

.mobile-alert-error {
    background: rgba(255, 107, 107, 0.1);
    color: #ff6b6b;
    border: 1px solid rgba(255, 107, 107, 0.2);
}

.mobile-alert-info {
    background: rgba(116, 185, 255, 0.1);
    color: #74b9ff;
    border: 1px solid rgba(116, 185, 255, 0.2);
}

/* Mobile Loading Spinner */
.mobile-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.mobile-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #800000;
    border-radius: 50%;
    animation: mobile-spin 1s linear infinite;
}

@keyframes mobile-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Typography */
.mobile-heading-1 {
    font-size: 1.8rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 1rem;
    text-align: center;
}

.mobile-heading-2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.75rem;
}

.mobile-text {
    font-size: 1rem;
    line-height: 1.6;
    color: #666;
    margin-bottom: 1rem;
}

.mobile-text-small {
    font-size: 0.9rem;
    color: #888;
}

/* Mobile Spacing Utilities */
.mobile-mt-1 { margin-top: 0.5rem; }
.mobile-mt-2 { margin-top: 1rem; }
.mobile-mt-3 { margin-top: 1.5rem; }
.mobile-mb-1 { margin-bottom: 0.5rem; }
.mobile-mb-2 { margin-bottom: 1rem; }
.mobile-mb-3 { margin-bottom: 1.5rem; }
.mobile-p-1 { padding: 0.5rem; }
.mobile-p-2 { padding: 1rem; }
.mobile-p-3 { padding: 1.5rem; }

/* Mobile Visibility */
.mobile-only {
    display: block;
}

.desktop-only {
    display: none;
}

/* Responsive Breakpoints */
@media (min-width: 768px) {
    .mobile-only {
        display: none;
    }
    
    .desktop-only {
        display: block;
    }
    
    .mobile-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .mobile-container {
        max-width: 1200px;
        padding: 2rem;
    }
}

@media (min-width: 1024px) {
    .mobile-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
    
    .mobile-form {
        max-width: 500px;
    }
}

/* Mobile-specific fixes for iOS */
@supports (-webkit-touch-callout: none) {
    .mobile-form-group input {
        font-size: 16px; /* Prevent zoom */
    }
    
    .mobile-btn {
        -webkit-appearance: none;
        border-radius: 12px;
    }
}

/* Mobile-specific fixes for Android */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .mobile-form-group select {
        background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'><path fill='%23666' d='M2 0L0 2h4zm0 5L0 3h4z'/></svg>");
        background-repeat: no-repeat;
        background-position: right 1rem center;
        background-size: 12px;
        padding-right: 3rem;
    }
}

/* Enhanced Mobile Navigation with Hamburger Menu */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        position: fixed;
        z-index: 1000;
        height: 100vh;
        overflow-y: auto;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
        padding-top: 80px;
    }

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

    /* Hamburger Menu Styles */
    .hamburger-menu {
        display: flex !important;
        flex-direction: column;
        background: none;
        border: none;
        cursor: pointer;
        padding: 10px;
        position: fixed;
        top: 20px;
        left: 20px;
        z-index: 1001;
        width: 40px;
        height: 40px;
        justify-content: center;
        align-items: center;
    }

    .hamburger-line {
        width: 25px;
        height: 3px;
        background: #800000;
        margin: 3px 0;
        transition: 0.3s;
        border-radius: 2px;
    }

    .hamburger-menu.active .hamburger-line:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
        background: white;
    }

    .hamburger-menu.active .hamburger-line:nth-child(2) {
        opacity: 0;
    }

    .hamburger-menu.active .hamburger-line:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
        background: white;
    }

    .nav-menu-mobile {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.95);
        z-index: 1000;
        padding-top: 80px;
        text-align: center;
        overflow-y: auto;
    }

    .nav-menu-mobile.active {
        display: block;
    }

    .nav-menu-mobile .nav-link {
        display: block;
        color: white;
        text-decoration: none;
        padding: 20px;
        font-size: 1.2rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        transition: background 0.3s ease;
    }

    .nav-menu-mobile .nav-link:hover,
    .nav-menu-mobile .nav-link.active {
        background: rgba(128, 0, 0, 0.8);
    }

    .nav-menu-mobile .nav-link i {
        margin-right: 10px;
        width: 20px;
    }

    .nav-menu-mobile .logout-btn {
        background: rgba(220, 53, 69, 0.8);
        margin-top: 20px;
        border-radius: 5px;
        margin-left: 20px;
        margin-right: 20px;
    }

    .nav-menu-mobile .logout-btn:hover {
        background: rgba(220, 53, 69, 1);
    }

    /* Hide desktop navigation on mobile */
    .nav-menu:not(.nav-menu-mobile) {
        display: none;
    }

    /* Ensure content doesn't overlap with hamburger */
    .dashboard-header,
    .section-header {
        margin-top: 60px;
    }
}

/* Desktop styles - hide mobile elements */
@media (min-width: 769px) {
    .hamburger-menu {
        display: none !important;
    }

    .nav-menu-mobile {
        display: none !important;
    }
}
