/**
 * Authentication Styles for PlayPodcast.net
 */

/* Button Spinner */
.auth-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: authSpin 0.6s linear infinite;
}

.auth-form button.secondary .auth-spinner {
    border-color: rgba(39, 37, 37, 0.2);
    border-top-color: #272525;
}

@keyframes authSpin {
    to { transform: rotate(360deg); }
}

.auth-form button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Large spinner for loading overlay */
.auth-spinner-lg {
    width: 36px;
    height: 36px;
    border-width: 3px;
    border-color: rgba(49, 183, 162, 0.2);
    border-top-color: #31b7a2;
}

/* Full-form loading overlay (shown during login data sync) */
.auth-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 10;
    border-radius: 16px;
}

.auth-loading-overlay p {
    color: #666;
    font-size: 15px;
    margin: 0;
}

/* Auth Button in Menu - hidden until session check completes to avoid flash */
#authContainer {
    position: relative;
    display: inline-block;
    margin-left: 8px;
    line-height: 80px;
    visibility: hidden;
}

#authContainer.ready {
    visibility: visible;
}

.auth-btn {
    cursor: pointer;
    color: #fff;
    padding: 4px;
    display: inline-block;
    opacity: 0.9;
    vertical-align: middle;
}

.auth-btn:hover {
    opacity: 1;
}

.auth-btn svg {
    display: block;
    width: 20px;
    height: 20px;
}

/* User Menu */
.user-menu {
    position: relative;
    display: inline-block;
}

.user-name {
    cursor: pointer;
    color: #fff;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: bold;
    line-height: 80px;
    margin: 0;
}

.user-name::before {
    content: '';
    width: 16px;
    height: 16px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
}

.user-dropdown {
    display: none;
    position: absolute;
    top: 50px;
    right: -20px;
    background: #516fa7;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    box-shadow: 0px 7px 7px -3px #3c405b;
    min-width: 130px;
    z-index: 1000;
    padding: 10px;
}

/* Show dropdown on hover */
.user-menu:hover .user-dropdown {
    display: block;
}

.user-dropdown a {
    display: block;
    padding: 3px 6px;
    color: #fff !important;
    text-decoration: none !important;
    font-size: 14px !important;
    font-weight: normal !important;
    line-height: 35px !important;
    margin: 0 !important;
    white-space: nowrap;
    transition: all 0.2s ease-in-out;
}

.user-dropdown a:hover {
    transform: translateX(6px);
    background: transparent;
}

/* Auth Modal */
.auth-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s;
}

.auth-modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

.auth-modal-content {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.auth-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    color: #888;
    cursor: pointer;
    z-index: 1;
}

.auth-close:hover {
    color: #333;
}

/* Auth Forms */
.auth-form {
    padding: 40px 30px;
}

.auth-form h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
    color: #272525;
}

.auth-subtitle {
    color: #666;
    margin: 0 0 24px 0;
    font-size: 14px;
}

.auth-form input {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: #31b7a2;
}

.auth-form button {
    width: 100%;
    padding: 14px;
    background: #31b7a2;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
}

.auth-form button:hover {
    background: #2a9d8a;
}

.auth-form button.secondary {
    background: #f5f5f5;
    color: #272525;
    margin-top: 12px;
}

.auth-form button.secondary:hover {
    background: #eee;
}

.auth-links {
    text-align: center;
    margin-top: 20px;
}

.auth-links a {
    color: #31b7a2;
    text-decoration: none;
    font-size: 14px;
    display: inline-block;
    margin: 0 8px;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Benefits List */
.auth-benefits {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    background: #f0faf8;
    border-radius: 8px;
    padding: 12px 16px;
}

.auth-benefits li {
    padding: 6px 0 6px 24px;
    position: relative;
    color: #444;
    font-size: 14px;
}

.auth-benefits li::before {
    content: '\2713';
    position: absolute;
    left: 0;
    color: #31b7a2;
    font-weight: bold;
}

/* Register Link at bottom of login form */
.auth-register-link {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    color: #666;
    font-size: 14px;
}

.auth-register-link a {
    color: #31b7a2;
    text-decoration: none;
    font-weight: 500;
}

.auth-register-link a:hover {
    text-decoration: underline;
}

/* Error and Success Messages */
.auth-error {
    background: #ffebee;
    color: #c62828;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.auth-success {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: #888;
    font-size: 14px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #ddd;
}

.auth-divider span {
    padding: 0 16px;
}

/* Google Button (for future use) */
.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.google-btn:hover {
    background: #f5f5f5;
}

.google-btn img {
    width: 20px;
    height: 20px;
}

/* Mobile Styles */
@media only screen and (max-width: 40.063em) {
    #authContainer {
        position: absolute !important;
        top: 77px;
        right: 2px;
        margin: 0;
        line-height: normal;
        z-index: 100;
    }

    #searchItem {
        left: 0 !important;
    }

    /* Don't use !important on display - let JS control visibility */
    .auth-btn {
        padding: 4px;
    }

    .auth-btn svg {
        width: 22px;
        height: 22px;
        stroke: #fff !important;
    }

    /* Hide name on mobile, show only icon */
    .user-name {
        line-height: normal;
        font-size: 0;
        padding: 4px;
    }

    .user-name::before {
        width: 22px;
        height: 22px;
    }

    .user-dropdown {
        position: fixed;
        right: 10px;
        top: 105px;
        min-width: 120px;
    }

    /* On mobile, show on click via .show class since hover doesn't work */
    .user-dropdown.show {
        display: block;
    }

    .auth-modal-content {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .auth-form {
        padding: 60px 20px 40px;
    }

    .auth-close {
        top: 20px;
        right: 20px;
    }
}

/* Signup Prompt Toast */
.signup-prompt {
    position: fixed;
    bottom: -200px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #516fa7 0%, #3d5a8f 100%);
    color: #fff;
    padding: 20px 28px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    font-size: 15px;
    transition: bottom 0.4s ease;
    max-width: 440px;
    width: 90%;
    text-align: center;
}

.signup-prompt.show {
    bottom: 140px;
}

.signup-prompt-title {
    font-weight: bold;
    font-size: 17px;
}

.signup-prompt-text {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.4;
}

.signup-prompt-btn {
    background: #31b7a2;
    color: #fff;
    padding: 10px 28px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 15px;
    white-space: nowrap;
    transition: background 0.2s, transform 0.15s;
}

.signup-prompt-btn:hover {
    background: #2a9d8a;
    transform: scale(1.03);
}

.signup-prompt-close {
    position: absolute;
    top: 10px;
    right: 14px;
    cursor: pointer;
    font-size: 22px;
    opacity: 0.6;
    line-height: 1;
}

.signup-prompt-close:hover {
    opacity: 1;
}

@media only screen and (max-width: 40.063em) {
    .signup-prompt {
        max-width: 92%;
        padding: 18px 16px;
    }
}
