/* Snapmeet Premium UI - Custom Notifications & Modals */

:root {
    /* Core Color Tokens */
    --sm-bg-primary: #F9FAFB;
    --sm-bg-secondary: #FFFFFF;
    --sm-bg-dark: #0B0F19;

    --sm-text-primary: #111827;
    --sm-text-secondary: #6B7280;
    --sm-text-muted: #9CA3AF;
    --sm-text-inverse: #FFFFFF;

    --sm-border-light: #E5E7EB;
    --sm-border-default: #D1D5DB;

    --sm-accent: #462ed4;
    --sm-accent-hover: #3725a8;
    --sm-accent-light: #f0effb;

    --sm-highlight: #F97316;
    --sm-highlight-light: #FED7AA;

    --sm-success: #16A34A;
    --sm-warning: #D97706;
    --sm-error: #DC2626;

    /* Legacy compatibility / UI specific */
    --sm-primary: var(--sm-accent);
    --sm-primary-hover: var(--sm-accent-hover);
    --sm-bg-glass: rgba(255, 255, 255, 0.9);
    --sm-border-glass: var(--sm-border-light);
    --sm-text-main: var(--sm-text-primary);
    --sm-text-muted: var(--sm-text-secondary);
}

/* Toast Container */
#sm-toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 999999999; /* Increased for extreme priority */
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 400px;
}

@media (max-width: 600px) {
    #sm-toast-container {
        top: env(safe-area-inset-top, 16px);
        bottom: auto; /* Moved from bottom to top for mobile visibility */
        left: 0;
        right: 0;
        max-width: none;
        padding: 0 16px;
        gap: 8px;
    }
}

/* Toast Item */
.sm-toast {
    pointer-events: auto;
    background: var(--sm-bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--sm-border-glass);
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
    overflow: hidden;
    position: relative;
    animation: sm-slide-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: all 0.3s ease;
}

@media (max-width: 600px) {
    .sm-toast {
        border-radius: 16px;
        padding: 14px 16px;
        gap: 12px;
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
        margin: 0;
        border: 1px solid var(--sm-border-glass);
    }

    .sm-toast-content {
        font-size: 13px;
    }

    .sm-toast-icon {
        font-size: 18px;
    }
}

.sm-toast.sm-closing {
    animation: sm-slide-out 0.3s ease forwards;
}

.sm-toast-icon {
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sm-toast-content {
    color: var(--sm-text-main);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
}

.sm-toast-close {
    background: transparent;
    border: none;
    color: var(--sm-text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    transition: color 0.2s;
}

.sm-toast-close:hover {
    color: var(--sm-text-main);
}

.sm-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--sm-primary);
    width: 100%;
    transform-origin: left;
}

/* Types */
.sm-toast.success .sm-toast-icon { color: var(--sm-success); }
.sm-toast.success .sm-toast-progress { background: var(--sm-success); }
.sm-toast.error .sm-toast-icon { color: var(--sm-error); }
.sm-toast.error .sm-toast-progress { background: var(--sm-error); }
.sm-toast.warning .sm-toast-icon { color: var(--sm-warning); }
.sm-toast.warning .sm-toast-progress { background: var(--sm-warning); }
.sm-toast.info .sm-toast-icon { color: var(--sm-info); }
.sm-toast.info .sm-toast-progress { background: var(--sm-info); }

/* Modal Overlay */
#sm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#sm-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Box */
.sm-modal {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 32px;
    max-width: 440px;
    width: 95%;
    padding: 40px 32px;
    box-shadow: 
        0 0 0 1px rgba(0, 0, 0, 0.05),
        0 20px 50px -12px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(20px);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: center;
    position: relative;
    overflow: hidden;
}

#sm-modal-overlay.active .sm-modal {
    transform: scale(1) translateY(0);
}

.sm-modal-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, rgba(70, 46, 212, 0.1), rgba(70, 46, 212, 0.05));
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 28px;
    font-size: 32px;
    color: var(--sm-primary);
    box-shadow: inset 0 0 0 1px rgba(70, 46, 212, 0.1);
    transform: rotate(-5deg);
    transition: transform 0.3s ease;
}

.sm-modal:hover .sm-modal-icon {
    transform: rotate(0deg) scale(1.05);
}

/* Modal Types */
.sm-modal.danger .sm-modal-icon {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.1), rgba(220, 38, 38, 0.05));
    color: var(--sm-error);
    box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.1);
}

.sm-modal.warning .sm-modal-icon {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.1), rgba(217, 119, 6, 0.05));
    color: var(--sm-warning);
    box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.1);
}

.sm-modal-title {
    color: #111827;
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.sm-modal-body {
    color: #4B5563;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 32px;
}

.sm-modal-footer {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.sm-btn {
    padding: 14px 28px;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: none;
    min-width: 140px;
}

.sm-btn-primary {
    background: #462ed4;
    color: white;
    box-shadow: 0 4px 12px rgba(70, 46, 212, 0.2);
}

.sm-btn-primary:hover {
    background: #3725a8;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(70, 46, 212, 0.3);
}

.sm-btn-secondary {
    background: #F3F4F6;
    color: #4B5563;
}

.sm-btn-secondary:hover {
    background: #E5E7EB;
}

.sm-btn-danger {
    background: #DC2626;
    color: white;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
}

.sm-btn-danger:hover {
    background: #B91C1C;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(220, 38, 38, 0.3);
}

.sm-btn-success {
    background: #16A34A;
    color: white;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.2);
}

.sm-btn-success:hover {
    background: #15803D;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(22, 163, 74, 0.3);
}

/* Warning Modal Specifics */
.sm-modal.warning {
    border-top: 5px solid var(--sm-warning);
}

.sm-modal-icon span.material-symbols-rounded {
    white-space: nowrap;
}


/* Edit Warning & Link Validation Specifics */
.sm-modal-warning .sm-modal-icon {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    animation: sm-pulse-warning 2s infinite;
}

@keyframes sm-pulse-warning {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.sm-link-help-container {
    text-align: left;
    margin: 1rem 0;
}

.sm-link-guide-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}

@media (max-width: 480px) {
    .sm-link-guide-grid {
        grid-template-columns: 1fr;
    }
}

.sm-link-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.sm-link-item i {
    font-size: 1.25rem;
    margin-top: 2px;
}

.sm-link-item span {
    font-size: 0.85rem;
    line-height: 1.3;
}

.sm-link-item small {
    color: #64748B;
    word-break: break-all;
}

.sm-link-tip {
    background: #fff7ed;
    border: 1px solid #ffedd5;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #9a3412;
}

/* Tooltips & Helpers */
.sm-modal.warning .sm-modal-body {
    font-weight: 500;
}

@media (max-width: 480px) {
    .sm-modal.warning {
        padding-top: 24px;
        margin: 20px;
    }
}



/* Animations... */
@keyframes sm-slide-in {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes sm-slide-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

@media (max-width: 600px) {
    @keyframes sm-slide-in {
        from {
            opacity: 0;
            transform: translateY(100px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    @keyframes sm-slide-out {
        from {
            opacity: 1;
            transform: translateY(0);
        }
        to {
            opacity: 0;
            transform: translateY(100px);
        }
    }
}

/* Premium Loader Styles */
#sm-loader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 20, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#sm-loader-overlay.active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.sm-loader-content {
    text-align: center;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#sm-loader-overlay.active .sm-loader-content {
    transform: translateY(0);
}

.sm-loader-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
}

.sm-loader-ring {
    position: absolute;
    inset: 0;
    border: 3px solid transparent;
    border-top-color: var(--sm-primary);
    border-radius: 50%;
    animation: sm-spin 1.2s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
}

.sm-loader-ring:nth-child(2) {
    border-top-color: var(--sm-success);
    animation-delay: -0.3s;
    border-width: 2px;
    inset: 10px;
    animation-duration: 1s;
}

.sm-loader-ring:nth-child(3) {
    border-top-color: var(--sm-warning);
    animation-delay: -0.6s;
    border-width: 2px;
    inset: 20px;
    animation-duration: 0.8s;
}

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

.sm-loader-message {
    color: white;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* Animations... */
