/* ========================================
   PREMIUM UI POLISH (Glass Toasts & more)
   ======================================== */

/* 1. Glass Toasts */
.toast-container {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10002;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    width: 90%;
    max-width: 400px;
}

.toast {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 1);
    padding: 0.8rem 1.2rem;
    padding-right: 1.5rem;
    border-radius: 16px;
    /* Slightly less round for a modern card feel, or keep 50px for pill */
    border-radius: 50px;
    box-shadow:
        0 10px 40px -10px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    animation: toastPopUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    pointer-events: auto;
    transition: all 0.3s ease;
    transform-origin: center bottom;
}

[data-theme="dark"] .toast {
    background: rgba(30, 30, 30, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
}

/* Icon Styling */
.toast span:first-child {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 50%;
}

[data-theme="dark"] .toast span:first-child {
    background: rgba(255, 255, 255, 0.1);
}

/* Specific States */
.toast.success {
    /* Subtle Green Tint */
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(240, 253, 244, 0.95));
    border-color: rgba(34, 197, 94, 0.2);
}

.toast.success span:first-child {
    background: rgba(34, 197, 94, 0.1);
    color: #15803d;
}

.toast.error {
    /* Subtle Red Tint */
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(254, 242, 242, 0.95));
    border-color: rgba(239, 68, 68, 0.2);
}

.toast.error span:first-child {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
}

/* Dark Mode States */
[data-theme="dark"] .toast.success {
    background: rgba(20, 40, 25, 0.9);
    border-color: rgba(34, 197, 94, 0.3);
}

[data-theme="dark"] .toast.success span:first-child {
    color: #4ade80;
}

[data-theme="dark"] .toast.error {
    background: rgba(40, 20, 20, 0.9);
    border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .toast.error span:first-child {
    color: #f87171;
}

@keyframes toastPopUp {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.9);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeOutDown {
    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

/* 2. Custom Scrollbar (Webkit) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
    transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
    border: 2px solid transparent;
    background-clip: content-box;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #444;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* 3. Global Button "Active" Bounce */
button:active,
.btn-primary-large:active,
.btn-action:active,
.radio-chip:active {
    transform: scale(0.96) !important;
}

/* 4. Loading Spinner for Buttons */
.btn-loading {
    color: transparent !important;
    position: relative;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-top: -10px;
    margin-left: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* 5. Input Focus Ring */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2);
    transition: all 0.2s ease;
}

[data-theme="dark"] input:focus {
    box-shadow: 0 0 0 3px rgba(138, 180, 248, 0.2);
}