/* ═══════════════════════════════════════════════════════════
   MODERN POP-CARD MODALS
   Well-designed modal pop-ups for alerts, forms, confirmations
   ═══════════════════════════════════════════════════════════ */

/* Backdrop */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Main Modal Container */
.modal-card {
    position: relative;
    background: white;
    border-radius: 24px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15),
                0 8px 16px rgba(0, 0, 0, 0.1);
    max-width: 90%;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 9999;
    animation: modalSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: scale(0.95);
    opacity: 0;
}

.modal-backdrop.active .modal-card {
    transform: scale(1);
    opacity: 1;
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.88);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Modal Header */
.modal-header {
    padding: 32px 32px 24px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #212529;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-header .close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-header .close-btn:hover {
    background: #f5f5f5;
    color: #333;
}

/* Modal Body */
.modal-body {
    padding: 32px;
}

/* Modal Footer */
.modal-footer {
    padding: 24px 32px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════
   ALERT MODALS
   ═══════════════════════════════════════════════════════════ */

/* Alert Card Layout */
.modal-card.alert-modal {
    max-width: 420px;
}

.modal-card.alert-modal .modal-body {
    text-align: center;
    padding: 40px 32px;
}

/* Alert Icon */
.alert-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    animation: iconBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes iconBounce {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Alert Type Styles */
.alert-icon.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border: 2px solid #28a745;
}

.alert-icon.alert-error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border: 2px solid #dc3545;
}

.alert-icon.alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    border: 2px solid #ffc107;
}

.alert-icon.alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    color: #0c5460;
    border: 2px solid #17a2b8;
}

/* Alert Text */
.alert-message {
    font-size: 1rem;
    color: #212529;
    margin-bottom: 12px;
    line-height: 1.6;
}

.alert-description {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════
   FORM MODALS (Login, Register, etc)
   ═══════════════════════════════════════════════════════════ */

.modal-card.form-modal {
    max-width: 500px;
    padding: 40px;
}

.modal-card.form-modal .modal-header {
    padding: 0 0 24px 0;
    border-bottom: none;
}

.modal-card.form-modal .modal-body {
    padding: 0;
}

.modal-card.form-modal .modal-footer {
    padding: 24px 0 0 0;
    border-top: none;
    justify-content: space-between;
}

/* Form Group */
.form-group-modal {
    margin-bottom: 20px;
}

.form-group-modal label {
    display: block;
    font-weight: 600;
    color: #212529;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-group-modal input,
.form-group-modal select,
.form-group-modal textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e7e9;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: white;
}

.form-group-modal input::placeholder,
.form-group-modal textarea::placeholder {
    color: #aaa;
}

.form-group-modal input:focus,
.form-group-modal select:focus,
.form-group-modal textarea:focus {
    outline: none;
    border-color: #28a745;
    box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.1);
    background: #fafbfc;
}

.form-group-modal input:disabled,
.form-group-modal select:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

/* Form Error */
.form-error {
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-error i {
    font-size: 0.9rem;
}

.form-success {
    color: #28a745;
    font-size: 0.85rem;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Checkbox/Radio in Modal */
.form-check-modal {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0;
}

.form-check-modal input[type="checkbox"],
.form-check-modal input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #28a745;
}

.form-check-modal label {
    margin: 0;
    cursor: pointer;
    font-weight: normal;
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS IN MODALS
   ═══════════════════════════════════════════════════════════ */

.btn-modal {
    padding: 12px 28px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    justify-content: center;
}

.btn-modal:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Primary Button */
.btn-modal-primary {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.btn-modal-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(40, 167, 69, 0.4);
    background: linear-gradient(135deg, #1e7e34 0%, #165a2a 100%);
}

/* Secondary Button */
.btn-modal-secondary {
    background: #f0f0f0;
    color: #212529;
    border: 1px solid #ddd;
}

.btn-modal-secondary:hover:not(:disabled) {
    background: #e8e8e8;
    border-color: #ccc;
}

/* Danger Button */
.btn-modal-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.btn-modal-danger:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(220, 53, 69, 0.4);
    background: linear-gradient(135deg, #c82333 0%, #ac1f2e 100%);
}

/* Link Button */
.btn-modal-link {
    background: none;
    color: #28a745;
    border: none;
    padding: 8px 0;
    font-weight: 600;
    min-width: auto;
    cursor: pointer;
}

.btn-modal-link:hover:not(:disabled) {
    color: #1e7e34;
    text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════
   CONFIRMATION MODALS
   ═══════════════════════════════════════════════════════════ */

.modal-card.confirm-modal {
    max-width: 420px;
}

.modal-card.confirm-modal .modal-body {
    text-align: center;
    padding: 32px;
}

.confirm-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    border: 2px solid #ffc107;
}

.confirm-message {
    font-size: 1.1rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 8px;
}

.confirm-description {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 24px;
}

/* ═══════════════════════════════════════════════════════════
   LOADING STATE
   ═══════════════════════════════════════════════════════════ */

.modal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #f0f0f0;
    border-top-color: #28a745;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
    .modal-card {
        max-width: 100%;
        width: 95%;
        margin: 20px;
    }

    .modal-card.form-modal {
        padding: 24px;
    }

    .modal-header {
        padding: 24px 24px 16px;
    }

    .modal-header h2 {
        font-size: 1.5rem;
    }

    .modal-body {
        padding: 24px;
    }

    .modal-footer {
        padding: 16px 24px;
        flex-direction: column;
    }

    .btn-modal {
        width: 100%;
        min-width: unset;
    }

    .alert-icon {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
}

/* Scrollbar styling */
.modal-card::-webkit-scrollbar {
    width: 8px;
}

.modal-card::-webkit-scrollbar-track {
    background: transparent;
}

.modal-card::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

.modal-card::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}
