/* ===== Modal Styles ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #fff;
    margin: auto;
    padding: 0;
    border-radius: 1.5rem;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255,255,255,0.1);
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(59, 130, 246, 0.1);
}

.modal-header {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 50%, #1e3a8a 100%);
    color: #fff;
    padding: 2.5rem 2rem;
    border-radius: 1rem 1rem 0 0;
    position: relative;
    overflow: hidden;
    text-align: center;
}

.modal-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 50%);
    animation: modal-shine 3s ease-in-out infinite;
}

@keyframes modal-shine {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(10%, 10%); }
}

.modal-header::after {
    content: '\f19d';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8rem;
    opacity: 0.08;
    pointer-events: none;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.85rem;
    font-weight: 800;
    position: relative;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    letter-spacing: -0.5px;
}

.modal-header p {
    margin: 0.75rem 0 0 0;
    opacity: 0.95;
    font-size: 1.05rem;
    position: relative;
    font-weight: 500;
}

.modal-close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    color: #fff;
    font-size: 1.75rem;
    font-weight: bold;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    z-index: 10;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg) scale(1.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.modal-body {
    padding: 2rem;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.modal-form .form-group {
    margin-bottom: 0;
}

.modal-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #1e3a8a;
    font-size: 0.95rem;
}

.modal-form input,
.modal-form select,
.modal-form textarea {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fff;
}

.modal-form input:focus,
.modal-form select:focus,
.modal-form textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    background: #fff;
}

.modal-form input:hover,
.modal-form select:hover,
.modal-form textarea:hover {
    border-color: #94a3b8;
}

.modal-form input.error,
.modal-form select.error {
    border-color: #ef4444;
}

.error-message {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: none;
}

.error-message.show {
    display: block;
}

.modal-form .checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.modal-form .checkbox-group input[type="checkbox"] {
    width: auto;
    margin-top: 0.25rem;
}

.modal-form .checkbox-group label {
    margin-bottom: 0;
    font-weight: normal;
    font-size: 0.875rem;
}

.modal-form .checkbox-group label a {
    color: var(--primary-600);
    text-decoration: underline;
}

.modal-footer {
    padding: 0 2rem 2rem 2rem;
    background: #fff;
}

.modal-footer .btn-primary {
    width: 100%;
    padding: 1.1rem;
    font-size: 1.15rem;
    font-weight: 700;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border: none;
    border-radius: 0.75rem;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    position: relative;
    overflow: hidden;
}

.modal-footer .btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.modal-footer .btn-primary:hover::before {
    left: 100%;
}

.modal-footer .btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.5);
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}

.success-message {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    border: 2px solid #34d399;
    color: #065f46;
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    display: none;
    animation: successPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes successPop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.success-message.show {
    display: block;
}

.success-message i {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
    color: #10b981;
    animation: checkBounce 0.6s ease;
}

@keyframes checkBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.success-message h3 {
    margin-bottom: 0.75rem;
    font-size: 1.6rem;
    font-weight: 700;
    color: #047857;
}

.success-message p {
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 1rem;
    }

    .modal-header {
        padding: 1.5rem;
    }

    .modal-header h2 {
        font-size: 1.5rem;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-footer {
        padding: 0 1.5rem 1.5rem 1.5rem;
    }
}
