/* ═══════════════════════════════════════════
   AKIYA CRM — Loading States & Toast Messages
   Claude-style elegant minimalism
═══════════════════════════════════════════ */

/* ── TOAST CONTAINER ── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

/* ── TOAST BASE ── */
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    padding: 14px 16px;
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(12px);
    pointer-events: all;
    transform: translateX(110%);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    border: 1px solid transparent;
}

.toast-show { transform: translateX(0); opacity: 1; }
.toast-hide { transform: translateX(110%); opacity: 0; }

/* ── TOAST TYPES ── */
.toast-success {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #fff;
    border-color: rgba(255,255,255,0.15);
}
.toast-error {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: #fff;
    border-color: rgba(255,255,255,0.15);
}
.toast-warning {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    color: #fff;
    border-color: rgba(255,255,255,0.15);
}
.toast-info {
    background: linear-gradient(135deg, #D97757 0%, #C86445 100%);
    color: #fff;
    border-color: rgba(255,255,255,0.15);
}

/* Dark mode toasts */
.dark-mode .toast { box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45); }
.dark-mode .toast-success { background: linear-gradient(135deg, #15803d 0%, #166534 100%); }
.dark-mode .toast-error   { background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%); }
.dark-mode .toast-warning { background: linear-gradient(135deg, #b45309 0%, #92400e 100%); }
.dark-mode .toast-info    { background: linear-gradient(135deg, #C86445 0%, #B55535 100%); }

/* ── TOAST PARTS ── */
.toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toast-message {
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 5px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.toast-close:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* ── LOADING STATES ── */
.btn-loading { position: relative; pointer-events: none; opacity: 0.8; }

.loading-spinner {
    display: inline-block;
    width: 15px;
    height: 15px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 7px;
    vertical-align: middle;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ── FIELD VALIDATION ── */
.field-error {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
}
.dark-mode .field-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18) !important;
}

.field-error-message {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #dc2626;
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 5px;
    animation: slideDown 0.2s ease-out;
}
.dark-mode .field-error-message { color: #f87171; }
.field-error-message::before { content: '⚠'; font-size: 0.85rem; }

.field-success {
    border-color: #16a34a !important;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1) !important;
}
.dark-mode .field-success {
    border-color: #22c55e !important;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15) !important;
}

/* ── PROGRESS OVERLAY ── */
.progress-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.progress-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top: 3px solid #D97757;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ── BUTTON LOADING VARIANTS ── */
.btn-loading.btn-primary  { background: var(--primary, #D97757) !important; border-color: var(--primary, #D97757) !important; color: #fff !important; }
.btn-loading.btn-success  { background: #16a34a !important; border-color: #16a34a !important; color: #fff !important; }
.btn-loading.btn-danger   { background: #dc2626 !important; border-color: #dc2626 !important; color: #fff !important; }
.btn-loading.btn-warning  { background: #d97706 !important; border-color: #d97706 !important; color: #fff !important; }
.btn-loading.btn-secondary { background: #6b7280 !important; border-color: #6b7280 !important; color: #fff !important; }

/* ── ANIMATIONS ── */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    .toast-container { top: 12px; right: 12px; left: 12px; }
    .toast { min-width: auto; max-width: 100%; }
}
