/**
 * Authentication Modal Styles
 * Theme: Dark with pink accent (#ec567c)
 */

/* ========== Modal Overlay ========== */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.auth-modal.active {
    opacity: 1;
    visibility: visible;
}

/* ========== Modal Container ========== */
.auth-modal .modal-inner {
    background-color: #161617;
    border-radius: 12px;
    width: 100%;
    max-width: 420px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: translateY(-30px);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.auth-modal.active .modal-inner {
    transform: translateY(0);
}

/* ========== Close Button ========== */
.auth-modal .close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: #888;
    font-size: 28px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
    line-height: 1;
}

.auth-modal .close-btn:hover {
    color: #fff;
    background-color: rgba(236, 86, 124, 0.2);
}

/* ========== Modal Content ========== */
.auth-modal .modal-content {
    padding: 40px 32px;
}

/* ========== Title ========== */
.auth-modal .modal-title {
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 28px 0;
    text-align: center;
}

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

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

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    background-color: #0d0d0d;
    border: 1px solid #333;
    border-radius: 8px;
    color: #fff;
    font-size: 15px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.auth-form input:focus {
    outline: none;
    border-color: #ec567c;
    box-shadow: 0 0 0 3px rgba(236, 86, 124, 0.15);
}

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

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

/* ========== Checkbox ========== */
.form-checkbox {
    margin-bottom: 24px !important;
}

.form-checkbox label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    margin-bottom: 0;
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    margin-top: 2px;
    accent-color: #ec567c;
    cursor: pointer;
}

.form-checkbox span {
    color: #999;
    font-size: 13px;
    line-height: 1.5;
    font-weight: 400;
}

.form-checkbox a {
    color: #ec567c;
    text-decoration: none;
}

.form-checkbox a:hover {
    text-decoration: underline;
}

/* ========== Error Messages ========== */
.error-message {
    display: none;
    color: #ff6b6b;
    font-size: 12px;
    margin-top: 6px;
    padding-left: 2px;
}

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

/* ========== Submit Button ========== */
.btn-submit {
    width: 100%;
    padding: 14px 20px;
    background-color: #ec567c;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-submit:hover:not(:disabled) {
    background-color: #e33561;
}

.btn-submit:active:not(:disabled) {
    transform: scale(0.98);
}

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

/* ========== Loading Spinner ========== */
.btn-loading {
    display: none;
}

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

.btn-submit.loading .btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-loading .spinner {
    width: 20px;
    height: 20px;
    animation: spin 0.8s linear infinite;
}

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

/* ========== Form Messages ========== */
.form-message {
    display: none;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 16px;
    text-align: center;
}

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

.form-message.success {
    background-color: rgba(76, 175, 80, 0.15);
    color: #4caf50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.form-message.error {
    background-color: rgba(244, 67, 54, 0.15);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

/* ========== Form Footer ========== */
.form-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #252525;
    color: #888;
    font-size: 14px;
}

.form-footer .switch-modal {
    color: #ec567c;
    text-decoration: none;
    font-weight: 500;
    margin-left: 4px;
    cursor: pointer;
}

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

/* ========== Turnstile Widget ========== */
.turnstile-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    min-height: 65px;
}

.cf-turnstile {
    margin: 0 auto;
}

/* ========== Body Lock ========== */
body.modal-open {
    overflow: hidden;
}

/* ========== User Menu (Header) ========== */
.auth-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    background: none;
}

.auth-btn.signin {
    color: #bbb;
}

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

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

.auth-btn.signup:hover {
    background-color: #e33561;
}

/* ========== User Menu Dropdown ========== */
.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: none;
    border: none;
    color: #bbb;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.user-menu-btn:hover {
    color: #fff;
    background-color: #161617;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ec567c, #e33561);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
}

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

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

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

.user-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background-color: #161617;
    border-radius: 8px;
    min-width: 200px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    display: none;
    z-index: 1000;
    overflow: hidden;
}

.user-menu.open .user-menu-dropdown {
    display: block;
}

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

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

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

.user-menu-dropdown .divider {
    height: 1px;
    background-color: #252525;
    margin: 4px 0;
}

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

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

/* ========== Favorite Button ========== */
.favorite-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #fff;
}

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

.favorite-btn svg {
    width: 18px;
    height: 18px;
    transition: all 0.2s ease;
}

.favorite-btn.favorited {
    color: #ec567c;
}

.favorite-btn.favorited svg {
    fill: #ec567c;
}

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

/* ========== Mobile Responsive ========== */
@media (max-width: 480px) {
    .auth-modal {
        padding: 0;
        align-items: flex-end;
    }

    .auth-modal .modal-inner {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 95vh;
    }

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

    .auth-modal .modal-title {
        font-size: 22px;
    }

    .auth-buttons {
        gap: 4px;
    }

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

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

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