/* Custom Modal Styles */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.custom-modal.active {
    display: flex;
}

.custom-modal__content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
    border: 1px solid var(--border);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.custom-modal__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--primary-soft), transparent);
}

.custom-modal__icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.custom-modal__icon--success {
    background: rgba(76, 175, 80, 0.1);
    color: #4caf50;
    border: 2px solid rgba(76, 175, 80, 0.3);
}

.custom-modal__icon--error {
    background: rgba(244, 67, 54, 0.1);
    color: #f44336;
    border: 2px solid rgba(244, 67, 54, 0.3);
}

.custom-modal__icon--warning {
    background: rgba(255, 152, 0, 0.1);
    color: #ff9800;
    border: 2px solid rgba(255, 152, 0, 0.3);
}

.custom-modal__icon--info {
    background: rgba(33, 150, 243, 0.1);
    color: #2196f3;
    border: 2px solid rgba(33, 150, 243, 0.3);
}

.custom-modal__title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.4;
}

.custom-modal__body {
    padding: 24px;
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 16px;
}

.custom-modal__input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-main);
    font-size: 18px;
    text-align: center;
    letter-spacing: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    font-family: 'Tajawal', sans-serif;
}

.custom-modal__input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.custom-modal__input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.custom-modal__footer {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

.custom-modal__btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Tajawal', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.custom-modal__btn--primary {
    background: linear-gradient(135deg, var(--primary-strong), var(--primary));
    color: white;
    box-shadow: 0 4px 12px rgba(184, 134, 11, 0.2);
}

.custom-modal__btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(184, 134, 11, 0.3);
}

.custom-modal__btn--secondary {
    background: var(--surface);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.custom-modal__btn--secondary:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
}

.custom-modal__btn--danger {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.2);
}

.custom-modal__btn--danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(244, 67, 54, 0.3);
}

.custom-modal__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    flex-direction: column;
    gap: 16px;
}

.custom-modal__spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.custom-modal__progress {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 16px;
}

.custom-modal__progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-strong), var(--primary));
    border-radius: 2px;
    animation: progressAnimation 5s linear forwards;
}

@keyframes progressAnimation {
    0% {
        width: 100%;
    }

    100% {
        width: 0%;
    }
}

/* Toast Notifications */
.custom-toast {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 10001;
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 400px;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    border: 1px solid var(--border);
}

.custom-toast.show {
    transform: translateX(0);
}

.custom-toast__icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.custom-toast__content {
    flex: 1;
}

.custom-toast__title {
    font-weight: 600;
    color: var(--text-main);
    margin: 0 0 4px 0;
    font-size: 14px;
}

.custom-toast__message {
    color: var(--text-muted);
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
}

.custom-toast__close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.custom-toast__close:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .custom-modal {
        padding: 10px;
    }

    .custom-modal__content {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .custom-modal__header {
        padding: 20px;
    }

    .custom-modal__body {
        padding: 20px;
    }

    .custom-modal__footer {
        padding: 16px 20px;
        flex-direction: column-reverse;
    }

    .custom-toast {
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100px);
    }

    .custom-toast.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .custom-modal__header {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }

    .custom-modal__title {
        font-size: 18px;
    }

    .custom-modal__body {
        font-size: 15px;
    }

    .custom-modal__btn {
        padding: 14px 20px;
    }
}