/**
 * Authentication & User Components CSS
 * Sign In/Sign Up Modals, User Menu, Favorite Button
 * Based on app6227.css color scheme
 */

/* ========================================
   Auth Modal Overlay & Container
   ======================================== */
.auth-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.auth-modal.active {
    display: flex;
    opacity: 1;
}

.auth-modal .modal-inner {
    background: #1a1a1a;
    border-radius: 8px;
    max-width: 420px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.auth-modal .modal-content {
    padding: 30px;
}

.auth-modal .close-btn {
    position: absolute;
    top: 12px;
    right: 15px;
    background: none;
    border: none;
    color: #a09f9d;
    font-size: 28px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    transition: color 0.2s;
    z-index: 10;
}

.auth-modal .close-btn:hover {
    color: #fff;
}

.auth-modal .modal-title {
    font-size: 24px;
    color: #fff;
    margin: 0 0 25px 0;
    text-align: center;
    font-weight: 600;
}

/* ========================================
   Auth Form Styles
   ======================================== */
.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form label {
    display: block;
    color: #a09f9d;
    font-size: 13px;
    margin-bottom: 8px;
    font-weight: 500;
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    background: #2a2a2a;
    border: 1px solid #3e3e3e;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.auth-form input[type="text"]:focus,
.auth-form input[type="email"]:focus,
.auth-form input[type="password"]:focus {
    outline: none;
    border-color: #eb6395;
    box-shadow: 0 0 0 3px rgba(235, 99, 149, 0.15);
}

.auth-form input::placeholder {
    color: #666;
}

.auth-form .error-message {
    display: none;
    color: #ff6b6b;
    font-size: 12px;
    margin-top: 6px;
}

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

.auth-form input.error {
    border-color: #ff6b6b;
}

/* Submit Button */
.auth-form .btn-submit {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #eb6395 0%, #d94f7e 100%);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.auth-form .btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(235, 99, 149, 0.4);
}

.auth-form .btn-submit:active {
    transform: translateY(0);
}

.auth-form .btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.auth-form .btn-submit .btn-text,
.auth-form .btn-submit .btn-loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.auth-form .btn-submit .btn-loading {
    display: none;
}

.auth-form .btn-submit.loading .btn-text {
    display: none;
}

.auth-form .btn-submit.loading .btn-loading {
    display: inline-flex;
}

.auth-form .spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Form Message (Success/Error) */
.auth-form .form-message {
    text-align: center;
    padding: 10px;
    border-radius: 4px;
    margin-top: 15px;
    display: none;
    font-size: 14px;
}

.auth-form .form-message.show {
    display: block;
}

.auth-form .form-message.success {
    background: rgba(91, 187, 102, 0.15);
    color: #5bbb66;
}

.auth-form .form-message.error {
    background: rgba(255, 107, 107, 0.15);
    color: #ff6b6b;
}

/* Form Footer - Switch Modal Link */
.auth-form .form-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #333;
    color: #a09f9d;
    font-size: 14px;
}

.auth-form .form-footer .switch-modal {
    color: #eb6395;
    text-decoration: none;
    margin-left: 5px;
    font-weight: 500;
}

.auth-form .form-footer .switch-modal:hover {
    text-decoration: underline;
}

/* Turnstile Container */
.auth-form .turnstile-container {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

/* ========================================
   Auth Buttons (Header - Logged Out)
   ======================================== */
.auth-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-buttons .auth-btn {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.auth-buttons .auth-btn.signin {
    background: transparent;
    color: #fff;
    border: 1px solid #3e3e3e;
}

.auth-buttons .auth-btn.signin:hover {
    background: #3e3e3e;
}

.auth-buttons .auth-btn.signup {
    background: #eb6395;
    color: #fff;
}

.auth-buttons .auth-btn.signup:hover {
    background: #d94f7e;
}

/* ========================================
   User Menu (Header - Logged In)
   ======================================== */
.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #3e3e3e;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.user-menu-btn:hover {
    background: #3e3e3e;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #eb6395 0%, #d94f7e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.user-menu-name {
    font-size: 13px;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
}

.user-menu.open .user-menu-arrow {
    transform: rotate(180deg);
}

/* User Dropdown */
.user-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: #1a1a1a;
    border: 1px solid #3e3e3e;
    border-radius: 6px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    overflow: hidden;
}

.user-menu.open .user-menu-dropdown {
    display: block;
    animation: dropdownFadeIn 0.2s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-menu-dropdown a,
.user-menu-dropdown button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 15px;
    color: #a09f9d;
    text-decoration: none;
    font-size: 14px;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.user-menu-dropdown a:hover,
.user-menu-dropdown button:hover {
    background: #2a2a2a;
    color: #fff;
}

.user-menu-dropdown svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.user-menu-dropdown .divider {
    height: 1px;
    background: #333;
    margin: 5px 0;
}

.user-menu-dropdown .logout-btn {
    color: #ff6b6b;
}

.user-menu-dropdown .logout-btn:hover {
    background: rgba(255, 107, 107, 0.1);
    color: #ff6b6b;
}

/* ========================================
   Favorite Button (Video Card)
   ======================================== */
.favorite-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
    opacity: 0;
}

.album-thumbnail-container:hover .favorite-btn,
.favorite-btn.is-favorite {
    opacity: 1;
}

.favorite-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.favorite-btn svg {
    width: 18px;
    height: 18px;
    stroke: #fff;
    fill: transparent;
    transition: all 0.2s;
}

.favorite-btn.is-favorite svg {
    stroke: #eb6395;
    fill: #eb6395;
}

.favorite-btn.loading {
    pointer-events: none;
}

.favorite-btn.loading svg {
    animation: pulse 0.5s ease infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Favorite Button in Player Page */
.player-favorite-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #2a2a2a;
    border: 1px solid #3e3e3e;
    border-radius: 4px;
    color: #a09f9d;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.player-favorite-btn:hover {
    background: #3e3e3e;
    color: #fff;
}

.player-favorite-btn svg {
    width: 16px;
    height: 16px;
}

.player-favorite-btn.is-favorite {
    background: rgba(235, 99, 149, 0.15);
    border-color: #eb6395;
    color: #eb6395;
}

.player-favorite-btn.is-favorite svg {
    fill: #eb6395;
}

/* ========================================
   Toast Notification
   ======================================== */
.toast-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1a1a1a;
    color: #fff;
    padding: 12px 24px;
    border-radius: 6px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    font-size: 14px;
}

.toast-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-notification.success {
    border-left: 4px solid #5bbb66;
}

.toast-notification.error {
    border-left: 4px solid #ff6b6b;
}

/* ========================================
   Responsive Styles
   ======================================== */
@media (max-width: 767px) {
    .auth-modal .modal-inner {
        width: 95%;
        margin: 10px;
    }

    .auth-modal .modal-content {
        padding: 20px;
    }

    .auth-buttons {
        gap: 8px;
    }

    .auth-buttons .auth-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .user-menu-name {
        display: none;
    }

    .user-menu-btn {
        padding: 6px 8px;
    }

    .favorite-btn {
        opacity: 1;
        width: 32px;
        height: 32px;
    }

    .favorite-btn svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 480px) {
    .auth-modal .modal-title {
        font-size: 20px;
    }

    .auth-form .btn-submit {
        padding: 12px 16px;
        font-size: 14px;
    }
}
