/**
 * NARA Auth Component Styles
 * Authentication modal and UI styles
 */

/* Auth Modal Overlay */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 120;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overscroll-behavior: contain;
}

.auth-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Auth Modal Container */
.auth-modal-container {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: linear-gradient(145deg, rgba(20, 20, 25, 0.98) 0%, rgba(10, 10, 15, 0.99) 100%);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 1.5rem;
    transform: scale(0.9) translateY(30px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.auth-modal-overlay.active .auth-modal-container {
    transform: scale(1) translateY(0);
}

/* Close Button */
.auth-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.auth-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Tab Switcher */
.auth-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-tab {
    flex: 1;
    padding: 1.25rem 1rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.3s ease;
    position: relative;
}

.auth-tab:hover {
    color: rgba(255, 255, 255, 0.8);
}

.auth-tab.active {
    color: white;
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, white, transparent);
}

/* Auth Forms */
.auth-form-container {
    padding: 1.5rem 2rem 2rem;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-input-group {
    margin-bottom: 1rem;
}

.auth-input-label {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.auth-input {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    color: white;
    font-size: 1rem;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.auth-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.auth-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.08);
}

.auth-submit {
    width: 100%;
    padding: 1rem 2rem;
    margin-top: 0.5rem;
    background: white;
    color: black;
    border: none;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.auth-submit:hover {
    transform: scale(1.02);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

.auth-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.auth-divider-line {
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.auth-divider-text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    text-transform: lowercase;
}

/* OAuth Buttons */
.auth-oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.auth-oauth-btn {
    width: 100%;
    padding: 0.875rem 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0.75rem;
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.auth-oauth-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.auth-oauth-btn svg {
    width: 20px;
    height: 20px;
}

.auth-oauth-btn.google:hover {
    border-color: rgba(234, 67, 53, 0.5);
}

.auth-oauth-btn.discord:hover {
    border-color: rgba(88, 101, 242, 0.5);
}

/* Error Message */
.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    color: #fca5a5;
    font-size: 0.875rem;
    display: none;
}

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

/* Success Message */
.auth-success {
    text-align: center;
    padding: 2rem;
}

.auth-success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(34, 197, 94, 0.05) 100%);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-success-icon i {
    font-size: 1.75rem;
    color: #22c55e;
}

.auth-success-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0.5rem;
}

.auth-success-text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

/* Profile Dropdown (Header) */
.profile-dropdown {
    position: relative;
    height: 40px;
    display: flex;
    align-items: center;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 9999px;
    transition: background-color 0.3s ease;
    height: 40px;
    box-sizing: border-box;
}

.profile-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
}

.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: black;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.profile-chevron {
    color: white;
    transition: transform 0.3s ease;
}

.profile-dropdown.open .profile-chevron {
    transform: rotate(180deg);
}

.profile-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 200px;
    background: rgba(20, 20, 25, 0.98);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    overflow: hidden;
}

.profile-dropdown.open .profile-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.profile-menu-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-menu-email {
    font-size: 0.85rem;
    color: white;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-menu-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: capitalize;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    text-align: left;
}

.profile-menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.profile-menu-item.logout {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #f87171;
}

.profile-menu-item.logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
}

/* Mobile Auth Button */
.auth-mobile-btn {
    text-align: center;
    padding: 0.875rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.75rem;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.auth-mobile-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Mobile Profile Section */
.profile-mobile {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 0.5rem;
}

.profile-mobile-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.profile-mobile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: black;
}

.profile-mobile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.profile-mobile-details {
    flex: 1;
}

.profile-mobile-email {
    font-size: 0.9rem;
    color: white;
    margin-bottom: 0.125rem;
}

.profile-mobile-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: capitalize;
}

.profile-mobile-logout {
    width: 100%;
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 0.5rem;
    color: #f87171;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.profile-mobile-logout:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Mobile Dashboard Link */
.profile-mobile-dashboard {
    display: block;
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.profile-mobile-dashboard:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Auth Skeleton Loader */
.auth-skeleton {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.5rem;
    height: 40px;
}

.auth-skeleton-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(90deg, rgba(255,255,255,0.08) 25%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.08) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.auth-skeleton-chevron {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Mobile skeleton */
.auth-skeleton-mobile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
}

.auth-skeleton-mobile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(90deg, rgba(255,255,255,0.08) 25%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.08) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.auth-skeleton-mobile-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.auth-skeleton-mobile-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.auth-skeleton-mobile-line:first-child {
    width: 70%;
}

.auth-skeleton-mobile-line:last-child {
    width: 40%;
}

/* Responsive */
@media (max-width: 640px) {
    .auth-modal-container {
        max-width: 100%;
        border-radius: 1rem;
    }

    .auth-form-container {
        padding: 1.25rem 1.5rem 1.5rem;
    }
}
