/* =============================================
   MODERN CENTERED LOGIN & REGISTER DESIGN
   Responsive, mobile-first approach
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@600;700&display=swap');

:root {
    --primary: #16a10a;
    --primary-dark: #0d6b07;
    --primary-light: #6de962;
    --secondary: #6de962;
    --success: #059669;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --bg-secondary: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --border-dark: #cbd5e1;
    --shadow: rgba(0, 0, 0, 0.08);
    --shadow-lg: rgba(0, 0, 0, 0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    color: var(--text);
    line-height: 1.6;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 100vh;
    padding: 1.25rem;
    overflow-x: hidden;
    overflow-y: auto;
}

body.login-centered {
    align-items: center;
}

/* =============================================
   AUTH CONTAINER
   ============================================= */

.auth-container {
    position: relative;
    width: 100%;
    max-width: 540px;
    min-height: auto;
    overflow: visible;
    max-height: none;
    margin: 0 auto;
}

.auth-bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(22, 161, 10, 0.05) 0%, rgba(109, 233, 98, 0.05) 100%);
    pointer-events: none;
    z-index: -1;
}

.auth-wrapper {
    background: var(--bg-secondary);
    border-radius: 1.5rem;
    box-shadow: 0 20px 60px var(--shadow-lg);
    padding: 1.9rem 1.4rem;
    animation: slideUp 0.5s ease-out;
    width: 100%;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =============================================
   HEADER SECTION
   ============================================= */

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-logo {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: inline-block;
}

.auth-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
}

/* =============================================
   TAB NAVIGATION
   ============================================= */

.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: var(--bg);
    padding: 0.35rem;
    border-radius: 1rem;
    width: 100%;
}

.auth-tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 0.75rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.auth-tab-btn:hover {
    color: var(--text);
}

.auth-tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(22, 161, 10, 0.3);
}

.auth-tab-btn i {
    font-size: 1rem;
}

/* =============================================
   FORM STYLES
   ============================================= */

.auth-tab-content {
    display: none;
    animation: fadeIn 0.3s ease-out;
    overflow: visible;
}

.auth-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.55rem 0.75rem;
    transition: all 0.3s ease;
    width: 100%;
    min-width: 0;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 161, 10, 0.1);
    background: #f8faf9;
}

.input-wrapper i {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.input-wrapper input,
.input-wrapper select {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 0.95rem;
    color: var(--text);
    font-family: inherit;
    min-width: 0;
}

.input-wrapper input::placeholder {
    color: var(--text-secondary);
}

.input-wrapper select {
    cursor: pointer;
    width: 100%;
    height: auto;
    line-height: 1.2;
}

.input-wrapper select option {
    color: var(--text);
    background: var(--bg-secondary);
}

.password-wrapper {
    padding-right: 0.5rem;
}

.password-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.password-toggle:hover {
    color: var(--primary);
}

/* Form row for side-by-side fields on larger screens */
.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.form-row .form-group {
    min-width: 0;
}

/* =============================================
   BUTTONS
   ============================================= */

.auth-btn {
    padding: 0.9rem 1.5rem;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(22, 161, 10, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(22, 161, 10, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

/* =============================================
   FEEDBACK MESSAGES
   ============================================= */

.username-feedback {
    font-size: 0.85rem;
    color: var(--danger);
    padding-left: 0.5rem;
}

.error-message {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    display: none;
}

.error-message.show {
    display: block;
}

/* =============================================
   FOOTER
   ============================================= */

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.auth-footer p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.auth-footer a:hover {
    color: var(--primary-dark);
}

/* =============================================
   RESPONSIVE DESIGN
   ============================================= */

@media (max-width: 640px) {
    body {
        padding: 0.75rem;
    }

    .auth-wrapper {
        padding: 1.1rem 0.9rem;
        border-radius: 1.25rem;
        max-width: 100%;
        width: 100%;
        min-height: auto;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }

    .auth-header {
        margin-bottom: 2rem;
    }

    .auth-title {
        font-size: 1.5rem;
    }

    .auth-subtitle {
        font-size: 0.9rem;
    }

    .auth-tabs {
        margin-bottom: 1.5rem;
    }

    .auth-tab-btn {
        padding: 0.65rem 0.75rem;
        font-size: 0.9rem;
    }

    .auth-tab-btn i {
        font-size: 0.9rem;
    }

    .auth-form {
        gap: 1rem;
    }

    .form-group {
        gap: 0.4rem;
    }

    .form-group label {
        font-size: 0.85rem;
    }

    .form-row.info-row {
        grid-template-columns: 1fr;
        gap: 0.7rem;
    }

    .form-row.password-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .input-wrapper {
        padding: 0.5rem 0.6rem;
    }

    .input-wrapper i {
        font-size: 1rem;
        margin-right: 0.5rem;
    }

    .input-wrapper input,
    .input-wrapper select {
        font-size: 0.88rem;
    }

    .auth-btn {
        padding: 0.8rem 1rem;
        font-size: 0.95rem;
    }

    .auth-footer {
        margin-top: 1.5rem;
        padding-top: 1rem;
    }

    .auth-footer p {
        font-size: 0.75rem;
    }
}

@media (max-width: 380px) {
    .auth-wrapper {
        padding: 1rem 0.7rem;
    }

    .auth-logo {
        font-size: 2rem;
    }

    .auth-title {
        font-size: 1.25rem;
    }

    .auth-tabs {
        padding: 0.25rem;
        gap: 0.25rem;
    }

    .auth-tab-btn {
        padding: 0.55rem 0.5rem;
        font-size: 0.8rem;
        gap: 0.25rem;
    }

    .auth-form {
        gap: 0.85rem;
    }

    .form-row.password-row {
        gap: 0.4rem;
    }
}

/* =============================================
   DARK MODE SUPPORT (Optional)
   ============================================= */

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1e293b;
        --bg-secondary: #0f172a;
        --text: #f1f5f9;
        --text-secondary: #cbd5e1;
        --border: #334155;
    }

    body {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    }

    .input-wrapper {
        background: #1e293b;
    }

    .input-wrapper:focus-within {
        background: #1a233d;
    }
}
