/* ============================================================================
   GRAVELFINDER AUTHENTICATION & USER SYSTEM STYLES
   Matches GravelFinder's earthy palette (#475e41) & modern UI aesthetic
   ============================================================================ */

:root {
    --gf-auth-primary: #475e41;
    --gf-auth-primary-dark: #354730;
    --gf-auth-primary-light: #5d7a55;
    --gf-auth-accent: #688760;
    --gf-auth-bg: #ffffff;
    --gf-auth-surface: #f8faf8;
    --gf-auth-border: #e2e8e2;
    --gf-auth-text: #222b20;
    --gf-auth-muted: #647462;
    --gf-auth-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --gf-auth-radius: 12px;
}

/* ============================================================================
   HEADER AUTHENTICATION WIDGET
   ============================================================================ */

.gf-auth-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Logged out state buttons */
.gf-auth-buttons {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.gf-auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.4rem 0.85rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    line-height: 1;
    border: none;
    white-space: nowrap;
}

.gf-auth-btn-ghost {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(4px);
}

.gf-auth-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.45);
    transform: translateY(-1px);
}

.gf-auth-btn-primary {
    background: #ffffff;
    color: var(--gf-auth-primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.gf-auth-btn-primary:hover {
    background: #f4f6f4;
    color: var(--gf-auth-primary-dark);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

/* Logged in state dropdown / capsule */
.gf-user-capsule {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(8px);
    color: #ffffff;
    padding: 0.25rem 0.65rem 0.25rem 0.35rem;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
}

.gf-user-capsule:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.gf-user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--gf-auth-primary-dark);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.gf-user-name {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #ffffff;
}

.gf-auth-btn-logout-tiny {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 12px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.gf-auth-btn-logout-tiny:hover {
    color: #ff9d9d;
    background: rgba(255, 0, 0, 0.15);
}

/* Mobile Sidebar Auth Item */
.gf-sidebar-auth {
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
    background: #edf3ec;
    border-radius: 10px;
    border: 1px solid #dbe6d9;
}

.gf-sidebar-auth-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* ============================================================================
   MODALS & OVERLAYS
   ============================================================================ */

.gf-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(18, 25, 17, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
    animation: gfFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.gf-modal-backdrop.is-active {
    display: flex;
}

.gf-modal-card {
    background: #ffffff;
    width: 100%;
    max-width: 440px;
    border-radius: var(--gf-auth-radius);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--gf-auth-border);
    animation: gfSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.gf-modal-card-wide {
    max-width: 520px;
}

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

@keyframes gfSlideUp {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.gf-modal-header {
    padding: 1.25rem 1.5rem 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gf-auth-border);
    background: #fafbfa;
}

.gf-modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gf-auth-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.gf-modal-close {
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--gf-auth-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 10;
}

.gf-modal-close:hover {
    background: #e7ece6;
    color: var(--gf-auth-text);
    transform: rotate(90deg);
}

.gf-modal-body {
    padding: 1.5rem;
}

/* Form controls */
.gf-form-group {
    margin-bottom: 1.1rem;
}

.gf-form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gf-auth-text);
    margin-bottom: 0.35rem;
}

.gf-form-input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    font-size: 0.92rem;
    font-family: inherit;
    border: 1px solid #ccd6ca;
    border-radius: 8px;
    background: #ffffff;
    color: var(--gf-auth-text);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.gf-form-input:focus {
    outline: none;
    border-color: var(--gf-auth-primary);
    box-shadow: 0 0 0 3px rgba(71, 94, 65, 0.18);
}

.gf-form-input::placeholder {
    color: #97a895;
}

.gf-form-checkbox-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    color: var(--gf-auth-muted);
}

.gf-form-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    user-select: none;
}

.gf-form-checkbox-label input[type="checkbox"] {
    accent-color: var(--gf-auth-primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Action button inside forms */
.gf-btn-submit {
    width: 100%;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, var(--gf-auth-primary) 0%, var(--gf-auth-primary-dark) 100%);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(71, 94, 65, 0.25);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.gf-btn-submit:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--gf-auth-primary-light) 0%, var(--gf-auth-primary) 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(71, 94, 65, 0.35);
}

.gf-btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.gf-modal-switch-text {
    margin-top: 1.2rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--gf-auth-muted);
}

.gf-modal-switch-link {
    color: var(--gf-auth-primary);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.gf-modal-switch-link:hover {
    text-decoration: underline;
}

/* ============================================================================
   SOCIAL OAUTH BUTTONS (GOOGLE & STRAVA)
   ============================================================================ */

.gf-social-auth-grid {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 1.25rem;
}

.gf-btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.65rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    cursor: pointer;
}

.gf-btn-google {
    background: #ffffff;
    color: #3c4043;
    border: 1px solid #dadce0;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.08);
}

.gf-btn-google:hover {
    background: #f8f9fa;
    border-color: #c6c9ce;
    box-shadow: 0 2px 6px rgba(60, 64, 67, 0.15);
    color: #202124;
    transform: translateY(-1px);
}

.gf-btn-strava {
    background: #FC4C02;
    color: #ffffff;
    border: 1px solid #e34402;
    box-shadow: 0 2px 6px rgba(252, 76, 2, 0.25);
}

.gf-btn-strava:hover {
    background: #e34402;
    box-shadow: 0 4px 12px rgba(252, 76, 2, 0.35);
    color: #ffffff;
    transform: translateY(-1px);
}

.gf-social-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gf-auth-divider {
    display: flex;
    align-items: center;
    margin: 1.25rem 0;
    text-align: center;
}

.gf-auth-divider::before,
.gf-auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--gf-auth-border);
}

.gf-auth-divider span {
    padding: 0 0.85rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gf-auth-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* ============================================================================
   PROFILE VIEW MODAL
   ============================================================================ */

.gf-profile-hero {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--gf-auth-border);
    margin-bottom: 1.25rem;
}

.gf-profile-avatar-large {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    object-fit: cover;
    background: linear-gradient(135deg, var(--gf-auth-primary) 0%, var(--gf-auth-primary-dark) 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.gf-profile-details h3 {
    margin: 0 0 0.2rem 0;
    font-size: 1.25rem;
    color: var(--gf-auth-text);
}

.gf-profile-details p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--gf-auth-muted);
}

.gf-profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.gf-stat-box {
    background: var(--gf-auth-surface);
    border: 1px solid var(--gf-auth-border);
    border-radius: 10px;
    padding: 0.85rem;
    text-align: center;
}

.gf-stat-number {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gf-auth-primary);
    margin-bottom: 0.15rem;
}

.gf-stat-label {
    font-size: 0.75rem;
    color: var(--gf-auth-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.gf-profile-actions {
    display: flex;
    gap: 0.75rem;
}

.gf-btn-secondary {
    flex: 1;
    padding: 0.65rem 1rem;
    background: #edf2ec;
    color: var(--gf-auth-text);
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid #d5ded4;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.gf-btn-secondary:hover {
    background: #e2ebe0;
}

.gf-btn-danger-outline {
    padding: 0.65rem 1rem;
    background: transparent;
    color: #c92a2a;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid #ffc9c9;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gf-btn-danger-outline:hover {
    background: #fff5f5;
    border-color: #ffa8a8;
}

/* ============================================================================
   TOAST NOTIFICATIONS
   ============================================================================ */

.gf-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.gf-toast {
    pointer-events: auto;
    background: #252e24;
    color: #ffffff;
    padding: 0.75rem 1.15rem;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border-left: 4px solid var(--gf-auth-primary-light);
    animation: gfToastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: all 0.25s ease;
}

.gf-toast.gf-toast-success {
    border-left-color: #4CAF50;
}

.gf-toast.gf-toast-error {
    border-left-color: #F44336;
}

.gf-toast.gf-toast-out {
    opacity: 0;
    transform: translateY(10px);
}

@keyframes gfToastIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Responsive adjust */
@media (max-width: 600px) {
    .gf-toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }
    .gf-user-name {
        display: none;
    }
    .gf-auth-btn {
        padding: 0.35rem 0.6rem;
        font-size: 0.78rem;
    }
}
