/**
 * CAISSA Auth UI Styles
 *
 * Styles for authentication components: buttons, avatar, dropdown, modals.
 */

/* ========================================
   AUTH CONTAINER
   ======================================== */

.caissa-auth-container {
    display: flex;
    align-items: center;
    margin-left: 8px;
}

/* ========================================
   SIGN IN BUTTON
   ======================================== */

.btn-auth-signin {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    border: none;
    border-radius: 6px;
    color: #0b0f1a;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-auth-signin:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(78, 205, 196, 0.3);
}

.btn-auth-signin i {
    font-size: 14px;
}

/* Hide text on small screens */
@media (max-width: 640px) {
    .btn-auth-signin .auth-btn-text {
        display: none;
    }
    .btn-auth-signin {
        padding: 8px 12px;
    }
}

/* ========================================
   USER BUTTON & AVATAR
   ======================================== */

.caissa-auth-user {
    position: relative;
}

.auth-user-button {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-user-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.auth-user-button:focus {
    outline: none;
    border-color: #4ecdc4;
}

.auth-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.auth-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.auth-avatar-initials {
    font-size: 14px;
    font-weight: 700;
    color: #0b0f1a;
}

.auth-premium-badge {
    position: absolute;
    top: -2px;
    right: 20px;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #ffc107, #ff8c00);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(255, 193, 7, 0.4);
}

.auth-premium-badge i {
    font-size: 8px;
    color: #0b0f1a;
}

.auth-credits-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: #1a2030;
    border: 1px solid #2a3142;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 600;
    color: #9c7cf4;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s, border-color 0.3s, background 0.3s;
}

.auth-credits-badge.low {
    color: #ff9800;
    border-color: rgba(255, 152, 0, 0.3);
}

.auth-credits-badge.zero {
    color: #f44336;
    border-color: rgba(244, 67, 54, 0.3);
    background: rgba(244, 67, 54, 0.1);
}

/* ========================================
   DROPDOWN MENU
   ======================================== */

.auth-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: #141923;
    border: 1px solid #2a3142;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.auth-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.auth-dropdown-header {
    padding: 16px;
    border-bottom: 1px solid #2a3142;
}

.auth-user-name {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #e8eaed;
    margin-bottom: 4px;
}

.auth-user-email {
    display: block;
    font-size: 12px;
    color: #9aa0a6;
    word-break: break-all;
}

.auth-dropdown-stats {
    display: flex;
    padding: 12px 16px;
    gap: 16px;
    border-bottom: 1px solid #2a3142;
}

.auth-stat {
    flex: 1;
    text-align: center;
}

.auth-stat-label {
    display: block;
    font-size: 11px;
    color: #5f6368;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.auth-stat-value {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #e8eaed;
}

.auth-stat-value.premium {
    color: #ffc107;
}

.auth-dropdown-actions {
    padding: 8px;
}

.auth-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #e8eaed;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
}

.auth-dropdown-item:hover {
    background: #1f2940;
}

.auth-dropdown-item i {
    width: 16px;
    text-align: center;
    color: #9aa0a6;
}

.auth-dropdown-item.upgrade {
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.auth-dropdown-item.upgrade:hover {
    background: rgba(255, 193, 7, 0.2);
}

.auth-dropdown-item.upgrade i {
    color: #ffc107;
}

.auth-dropdown-item.signout:hover {
    color: #f44336;
}

.auth-dropdown-item.signout:hover i {
    color: #f44336;
}

/* ========================================
   LOCKED FEATURE MODAL
   ======================================== */

.caissa-locked-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.caissa-locked-modal.show {
    opacity: 1;
}

.locked-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.locked-modal-content {
    position: relative;
    max-width: 380px;
    width: 90%;
    padding: 32px;
    background: #141923;
    border: 1px solid #2a3142;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.2s ease;
}

.caissa-locked-modal.show .locked-modal-content {
    transform: scale(1);
}

.locked-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: #9aa0a6;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
}

.locked-modal-close:hover {
    background: #1f2940;
    color: #e8eaed;
}

.locked-modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: rgba(244, 67, 54, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.locked-modal-icon i {
    font-size: 28px;
    color: #f44336;
}

.locked-modal-title {
    margin: 0 0 12px;
    font-size: 20px;
    font-weight: 700;
    color: #e8eaed;
}

.locked-modal-message {
    margin: 0 0 24px;
    font-size: 14px;
    color: #9aa0a6;
    line-height: 1.6;
}

.locked-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.locked-modal-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
}

.locked-modal-cancel {
    padding: 10px 24px;
    background: transparent;
    border: 1px solid #2a3142;
    border-radius: 8px;
    color: #9aa0a6;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.locked-modal-cancel:hover {
    background: #1f2940;
    color: #e8eaed;
}

/* ========================================
   AUTH PAGES (Sign In / Sign Up)
   ======================================== */

.auth-page-body {
    min-height: 100vh;
    background: #0b0f1a;
    display: flex;
    flex-direction: column;
}

.auth-page-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.auth-page-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    text-decoration: none;
}

.auth-page-logo i {
    font-size: 36px;
    color: #4ecdc4;
}

.auth-page-logo span {
    font-size: 24px;
    font-weight: 700;
    color: #e8eaed;
}

.auth-page-card {
    width: 100%;
    max-width: 400px;
    padding: 32px;
    background: #141923;
    border: 1px solid #2a3142;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.auth-page-title {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 700;
    color: #e8eaed;
    text-align: center;
}

.auth-page-subtitle {
    margin: 0 0 24px;
    font-size: 14px;
    color: #9aa0a6;
    text-align: center;
}

/* Clerk component container */
.auth-clerk-container {
    min-height: 300px;
}

.auth-page-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 14px;
    color: #9aa0a6;
}

.auth-page-footer a {
    color: #4ecdc4;
    text-decoration: none;
}

.auth-page-footer a:hover {
    text-decoration: underline;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 480px) {
    .auth-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        min-width: 100%;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }

    .auth-dropdown.open {
        transform: translateY(0);
    }

    .auth-page-card {
        padding: 24px 20px;
    }
}

/* ========================================
   CAISSA NOTIFY — TOAST NOTIFICATIONS
   ======================================== */

.caissa-notify-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.caissa-toast {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #e8e6e3;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    pointer-events: auto;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    white-space: nowrap;
    max-width: 90vw;
}

.caissa-toast--visible {
    opacity: 1;
    transform: translateY(0);
}

.caissa-toast--exit {
    opacity: 0;
    transform: translateY(-8px);
}

.caissa-toast--success { background: #27ae60; }
.caissa-toast--error   { background: #c0392b; }
.caissa-toast--warn    { background: #d4910a; }
.caissa-toast--info    { background: #2980b9; }

.caissa-toast-icon { font-size: 0.9rem; flex-shrink: 0; }
.caissa-toast-msg  { flex: 1; overflow: hidden; text-overflow: ellipsis; }
