/* =========================================
   BASE & VARIABLES (Commun)
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Singapore Flag Red Palette - Updated & Brighter */
    --singapore-red: #ED2939;
    --singapore-dark: #C41E3A;
    --singapore-deeper: #8A1525;
    --singapore-black: #1A0505;
    --singapore-light: #FF4D5E;
    --singapore-accent: #FF7B88;
    --singapore-subtle: #FFF0F1;
    
    /* Complementary Colors */
    --gold-singapore: #D4AF37;
    --platinum: #F5F5F5;
    --charcoal: #333333;
    --pure-white: #FFFFFF;
    
    /* Gradients */
    --gradient-singapore: linear-gradient(135deg, #8A1525 0%, #C41E3A 40%, #ED2939 100%);
    --gradient-reverse: linear-gradient(135deg, #ED2939 0%, #C41E3A 60%, #8A1525 100%);
    --gradient-accent: linear-gradient(135deg, #FF7B88 0%, #ED2939 100%);
    --gradient-subtle: linear-gradient(135deg, #FFF0F1 0%, #FFFFFF 100%);
    
    /* Typography */
    --font-display: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
    
    /* Shadows */
    --shadow-primary: 0 25px 60px rgba(237, 41, 57, 0.2);
    --shadow-secondary: 0 10px 30px rgba(237, 41, 57, 0.15);
    --shadow-soft: 0 5px 20px rgba(0, 0, 0, 0.05);
    
    /* Transitions */
    --transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    --transition-fast: all 0.2s ease-out;
}

body {
    font-family: var(--font-body);
    line-height: 1.7;
    color: var(--charcoal);
    background: #2A1A1E;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Background Pattern (Commun) */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23C41E3A' fill-opacity='0.12'%3E%3Cpath d='M0 0h30v30H0z'/%3E%3Cpath d='M30 30h30v30H30z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
    z-index: -1;
}

/* Navigation (Base) */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(26, 10, 14, 0.98);
    backdrop-filter: blur(25px);
    border-bottom: 1px solid rgba(237, 41, 57, 0.15);
    padding: 1.2rem 0;
    transition: var(--transition);
}

.navbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-accent);
    opacity: 0.7;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    /* Default to space-between for dashboard */
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--pure-white);
    text-decoration: none;
    transition: var(--transition-fast);
}

.logo:hover {
    transform: translateY(-1px);
}

.logo-icon {
    width: 50px;
    height: 50px;
    background: var(--singapore-dark);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--pure-white);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    box-shadow: var(--shadow-soft);
}

.logo-text {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* =========================================
   SPECIFIC: AUTH PAGE (Login/Register)
   ========================================= */

/* Override body for Auth Page specifically to center content */
body.auth-mode {
    display: flex;
    align-items: center;
    justify-content: center;
}

body.auth-mode .nav-container {
    justify-content: center;
}

.auth-page {
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    z-index: 100;
}

.auth-container {
    background: rgba(26, 10, 14, 0.98);
    backdrop-filter: blur(30px);
    border-radius: 35px;
    padding: 3.5rem;
    text-align: center;
    box-shadow: var(--shadow-primary);
    border: 1px solid rgba(237, 41, 57, 0.2);
    position: relative;
    overflow: hidden;
    color: var(--pure-white);
}

.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--gradient-accent);
}

.auth-container::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(237, 41, 57, 0.05) 0%, transparent 50%);
    z-index: -1;
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.welcome-message {
    margin-bottom: 2.5rem;
}

.welcome-title {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 800;
    color: var(--pure-white);
    margin-bottom: 1rem;
    line-height: 1.1;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    letter-spacing: -0.02em;
}

.welcome-subtitle {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.2rem;
    margin-bottom: 2rem;
    font-weight: 400;
    line-height: 1.6;
}

.auth-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 0.4rem;
    margin-bottom: 2.5rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
}

.auth-tab {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    background: none;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    color: rgba(255, 255, 255, 0.7);
    position: relative;
}

.auth-tab::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-accent);
    border-radius: 16px;
    opacity: 0;
    transition: var(--transition);
    z-index: -1;
}

.auth-tab.active {
    color: var(--pure-white);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    font-weight: 700;
}

.auth-tab.active::before {
    opacity: 0.8;
}

.auth-tab:hover:not(.active) {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.05);
}

.auth-form {
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.auth-form.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-group {
    margin-bottom: 2rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--pure-white);
    font-size: 1rem;
    letter-spacing: 0.3px;
}

.form-group input {
    width: 100%;
    padding: 1.2rem 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 18px;
    font-size: 1rem;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.08);
    color: var(--pure-white);
    backdrop-filter: blur(15px);
    font-weight: 500;
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.form-group input:focus {
    outline: none;
    border-color: var(--singapore-accent);
    box-shadow: 0 0 0 4px rgba(255, 107, 122, 0.15);
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.form-group.error input {
    border-color: #FF6B6B;
    background: rgba(255, 107, 107, 0.15);
    box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.1);
}

/* Password visibility toggle */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-right: 3.5rem !important;
}

.password-toggle {
    position: absolute;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    cursor: pointer;
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.6);
    transition: var(--transition);
    padding: 0.5rem;
    border-radius: 10px;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.password-toggle:hover {
    color: var(--singapore-accent);
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-50%) scale(1.1);
}

/* Password strength indicator */
.password-strength {
    margin-top: 1rem;
}

.strength-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.75rem;
    backdrop-filter: blur(10px);
}

.strength-progress {
    height: 100%;
    width: 0%;
    transition: width 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), background-color 0.3s ease;
    border-radius: 3px;
    position: relative;
}

.strength-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.strength-progress.weak {
    background: linear-gradient(90deg, #FF6B6B 0%, #FF8E8E 100%);
}

.strength-progress.medium {
    background: linear-gradient(90deg, #FFD93D 0%, #FFE066 100%);
}

.strength-progress.strong {
    background: linear-gradient(90deg, #6BCF7F 0%, #85D895 100%);
}

.strength-text {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.75);
    text-align: left;
    font-weight: 500;
}

.submit-btn {
    width: 100%;
    padding: 1.3rem 2rem;
    background: var(--singapore-dark);
    color: var(--pure-white);
    border: none;
    border-radius: 20px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
    margin-top: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

.submit-btn:hover {
    background: var(--singapore-deeper);
    box-shadow: var(--shadow-secondary);
}

.submit-btn:active {
    transform: translateY(1px);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.error-message {
    color: #FF8E8E;
    font-size: 0.9rem;
    margin-top: 0.75rem;
    display: block;
    text-align: left;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 107, 107, 0.1);
    border-radius: 10px;
    border-left: 3px solid #FF6B6B;
}

/* =========================================
   SPECIFIC: DASHBOARD PAGE
   ========================================= */

.user-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: var(--pure-white);
    font-weight: 500;
}

.logout-btn {
    background: rgba(237, 41, 57, 0.2);
    border: 2px solid var(--singapore-red);
    color: var(--pure-white);
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.logout-btn:hover {
    background: var(--singapore-red);
    transform: translateY(-2px);
    box-shadow: var(--shadow-secondary);
}

.main-page {
    padding-top: 120px;
    min-height: 100vh;
}

.hero-section {
    text-align: center;
    padding: 5rem 2rem 8rem;
    position: relative;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(237, 41, 57, 0.1) 0%, transparent 70%);
    z-index: -1;
}

.hero-title {
    font-family: var(--font-display);
    font-size: 4.5rem;
    font-weight: 800;
    color: var(--pure-white);
    margin-bottom: 1.5rem;
    text-shadow: 0 4px 20px rgba(26, 10, 14, 0.5);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 1.4rem;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 3rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    font-weight: 400;
    line-height: 1.6;
}

.clubs-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem 8rem;
}

.clubs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 3.5rem;
}

.club-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 245, 246, 0.95) 100%);
    backdrop-filter: blur(30px);
    border-radius: 32px;
    padding: 3rem;
    text-align: center;
    transition: var(--transition);
    border: 1px solid rgba(237, 41, 57, 0.08);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    opacity: 0;
    transform: translateY(30px);
    box-shadow: var(--shadow-soft);
}

.club-card.animate {
    opacity: 1;
    transform: translateY(0);
}

.club-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: var(--transition);
}

.club-card::after {
    content: '';
    position: absolute;
    inset: -1px;
    background: var(--gradient-accent);
    border-radius: 32px;
    z-index: -1;
    opacity: 0;
    transition: var(--transition);
}

.club-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: var(--shadow-primary);
}

.club-card:hover::before {
    transform: scaleX(1);
}

.club-card:hover::after {
    opacity: 0.05;
}

.club-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    background: var(--gradient-singapore);
    color: var(--pure-white);
    border-radius: 28px;
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
    position: relative;
    box-shadow: var(--shadow-secondary);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.club-number::after {
    content: '';
    position: absolute;
    inset: -3px;
    background: var(--gold-singapore);
    border-radius: 31px;
    z-index: -1;
    opacity: 0;
    transition: var(--transition);
}

.club-card:hover .club-number {
    transform: rotateY(360deg);
}

.club-card:hover .club-number::after {
    opacity: 0.3;
}

.club-name {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--singapore-dark);
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.club-description {
    color: var(--charcoal);
    margin-bottom: 2rem;
    line-height: 1.7;
    font-size: 1.05rem;
    opacity: 0.8;
}

.club-details {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(237, 41, 57, 0.05) 0%, rgba(255, 245, 246, 0.8) 100%);
    border-radius: 20px;
    border: 1px solid rgba(237, 41, 57, 0.1);
}

.club-detail {
    text-align: center;
    flex: 1;
}

.club-detail-value {
    font-weight: 800;
    color: var(--singapore-dark);
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    font-family: var(--font-display);
}

.club-detail-label {
    font-size: 0.9rem;
    color: var(--charcoal);
    font-weight: 500;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.join-btn {
    width: 100%;
    padding: 1.2rem 2rem;
    background: var(--gradient-singapore);
    color: var(--pure-white);
    border: none;
    border-radius: 20px;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-secondary);
}

.join-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-primary);
    background: var(--gradient-reverse);
}

.join-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

/* =========================================
   COMMON UTILITIES & ANIMATIONS
   ========================================= */

.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid var(--pure-white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.notification {
    position: fixed;
    top: 100px;
    right: 2rem;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(25px);
    padding: 1.5rem 2rem;
    border-radius: 20px;
    box-shadow: var(--shadow-primary);
    border: 1px solid rgba(237, 41, 57, 0.1);
    z-index: 2001;
    transform: translateX(450px);
    transition: var(--transition);
    max-width: 400px;
    font-weight: 500;
    font-size: 1rem;
    color: var(--charcoal);
}

.notification.success {
    border-left: 5px solid #4CAF50;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.05) 0%, rgba(255, 255, 255, 0.98) 100%);
}

.notification.error {
    border-left: 5px solid #F44336;
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.05) 0%, rgba(255, 255, 255, 0.98) 100%);
}

.notification.warning {
    border-left: 5px solid #FF9800;
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.05) 0%, rgba(255, 255, 255, 0.98) 100%);
}

.notification.info {
    border-left: 5px solid var(--singapore-red);
    background: linear-gradient(135deg, rgba(237, 41, 57, 0.05) 0%, rgba(255, 255, 255, 0.98) 100%);
}

/* Animations avancées */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.8s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

.slide-in-right {
    animation: slideInRight 0.6s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

.slide-in-left {
    animation: slideInLeft 0.6s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

.club-card:active {
    transform: translateY(-8px) scale(0.98);
}

.join-btn:active {
    transform: translateY(-1px) scale(0.98);
}

.form-group input:focus + .password-toggle {
    color: var(--singapore-accent);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .clubs-grid {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
        gap: 2.5rem;
    }
}

@media (max-width: 768px) {
    .nav-container {
        padding: 0 1rem;
    }

    .logo-text {
        font-size: 1.4rem;
    }
    
    /* Auth Responsive */
    .auth-container {
        padding: 2.5rem;
        margin: 1rem;
    }

    /* Dashboard Responsive */
    .hero-title {
        font-size: 3rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .clubs-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .club-card {
        padding: 2.5rem 2rem;
    }

    .club-details {
        flex-direction: column;
        gap: 1.5rem;
    }

    .notification {
        right: 1rem;
        max-width: calc(100% - 2rem);
    }
}

@media (max-width: 480px) {
    /* Auth */
    .auth-container {
        padding: 2rem;
    }
    .auth-page {
        padding: 1rem;
    }
    .auth-tabs {
        flex-direction: column;
        gap: 0.5rem;
    }
    .auth-tab {
        width: 100%;
    }

    /* Dashboard */
    .hero-section {
        padding: 3rem 1rem 5rem;
    }
    .hero-title {
        font-size: 2.5rem;
    }
    .clubs-section {
        padding: 0 1rem 4rem;
    }
    .club-number {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }
    .club-name {
        font-size: 1.75rem;
    }
    .club-card {
        padding: 2rem 1.5rem;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --singapore-dark: #000000;
        --charcoal: #000000;
        --pure-white: #FFFFFF;
    }
    .club-card {
        border: 2px solid var(--singapore-dark);
    }
    .auth-container {
        border: 3px solid var(--singapore-red);
    }
    .form-group input {
        border: 2px solid var(--pure-white);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .auth-container::after {
        animation: none;
    }
    .club-card:hover {
        transform: none;
    }
    .join-btn:hover {
        transform: none;
    }
    .form-group input:focus {
        transform: none;
    }
}

/* Print Styles */
@media print {
    .navbar { display: none; }
    .auth-container {
        box-shadow: none;
        border: 2px solid var(--singapore-dark);
        background: white;
        color: black;
    }
    body { background: white; }
    body::before { display: none; }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .club-card {
        background: linear-gradient(145deg, rgba(26, 10, 14, 0.95) 0%, rgba(139, 21, 56, 0.9) 100%);
        color: var(--pure-white);
        border: 1px solid rgba(237, 41, 57, 0.3);
    }
    .club-name { color: var(--pure-white); }
    .club-description { color: rgba(255, 255, 255, 0.8); }
    .club-detail-value { color: var(--singapore-accent); }
    .club-detail-label { color: rgba(255, 255, 255, 0.6); }
    
    .notification {
        background: rgba(26, 10, 14, 0.98);
        color: var(--pure-white);
        border: 1px solid rgba(237, 41, 57, 0.3);
    }
}