/* ===== MODERN MODAL STYLES WITH LIGHT BLUE THEME ===== */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(6px);
    }
}

.modal.hidden {
    display: none !important;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Result Popup - Always Display as Flex */
#result-popup:not(.hidden) {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

#result-popup.hidden {
    display: none !important;
}

/* ===== MODAL CONTENT ===== */
.modal-content {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.92));
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 20px;
    padding: 36px 32px;
    width: 90%;
    max-width: 450px;
    position: relative;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    animation: modalSlideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    max-height: 90vh;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: rgba(56, 189, 248, 0.05);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.3);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(56, 189, 248, 0.5);
}

/* ===== CLOSE BUTTON ===== */
.close {
    color: #cbd5e1;
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 32px;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(56, 189, 248, 0.05);
}

.close:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    transform: rotate(90deg) scale(1.1);
}

/* ===== MODAL HEADING ===== */
.modal-content h2 {
    margin: 0 0 28px 0;
    color: #f1f5f9;
    font-size: 1.6rem;
    font-weight: 800;
    text-align: center;
    background: linear-gradient(135deg, #38bdf8, #06b6d4, #0284c7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

/* ===== FORM STYLES ===== */
.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #cbd5e1;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid rgba(56, 189, 248, 0.25);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.8);
    color: #f1f5f9;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.form-group input::placeholder {
    color: rgba(203, 213, 225, 0.5);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #38bdf8;
    background: rgba(2, 132, 199, 0.1);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.25), inset 0 0 8px rgba(56, 189, 248, 0.05);
}

.form-group input:disabled {
    background: rgba(30, 41, 59, 0.5);
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ===== ERROR STATES ===== */
.form-group input.error,
.form-group textarea.error {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.form-group input.error:focus,
.form-group textarea.error:focus {
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.25), inset 0 0 8px rgba(239, 68, 68, 0.05);
}

.error-message {
    color: #fca5a5;
    font-size: 0.8rem;
    margin-top: 6px;
    display: none;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.error-message.show {
    display: block;
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* ===== SUCCESS STATES ===== */
.form-group input.success {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

.form-group input.success:focus {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.25), inset 0 0 8px rgba(16, 185, 129, 0.05);
}

/* ===== FORM ACTIONS ===== */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 28px;
    flex-wrap: wrap;
}

.form-actions .btn {
    flex: 1;
    max-width: 140px;
    padding: 12px 20px;
    border-radius: 10px;
    border: none;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}

.form-actions .btn.primary {
    background: linear-gradient(135deg, #0284c7, #06b6d4, #0369a1);
    color: #e0f2fe;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.form-actions .btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.4);
}

.form-actions .btn:not(.primary) {
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #38bdf8;
}

.form-actions .btn:not(.primary):hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: rgba(56, 189, 248, 0.5);
}

.form-actions .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ===== RESULT POPUP SPECIAL STYLES ===== */
#result-popup .modal-content {
    max-width: 420px;
}

#result-popup .modal-content h2 {
    margin-bottom: 24px;
    font-size: 1.5rem;
}

#result-popup .modal-content > div {
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.1), rgba(6, 182, 212, 0.08));
    border: 1px solid rgba(56, 189, 248, 0.2);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

#result-popup p {
    margin: 12px 0;
    color: #cbd5e1;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#result-popup strong {
    color: #38bdf8;
    font-weight: 700;
}

#result-popup span {
    color: #86efac;
    font-weight: 700;
    font-size: 1.1rem;
}

#result-popup .btn.primary {
    width: 100%;
    max-width: none;
    padding: 14px 20px;
    font-size: 1rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .modal-content {
        width: 95%;
        padding: 28px 20px;
        border-radius: 16px;
        max-height: 85vh;
    }

    .modal-content h2 {
        font-size: 1.3rem;
        margin-bottom: 20px;
    }

    .form-group label {
        font-size: 0.9rem;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 10px 12px;
        font-size: 0.95rem;
    }

    .form-actions {
        gap: 8px;
        margin-top: 24px;
    }

    .form-actions .btn {
        max-width: none;
        flex: 1;
        min-width: 100px;
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .close {
        font-size: 28px;
        top: 12px;
        right: 16px;
        width: 28px;
        height: 28px;
    }

    #result-popup .modal-content > div {
        padding: 16px;
        margin-bottom: 16px;
    }

    #result-popup p {
        font-size: 0.95rem;
        margin: 10px 0;
    }

    #result-popup span {
        font-size: 1rem;
    }
}

@media (max-width: 400px) {
    .modal-content {
        width: 100%;
        padding: 24px 16px;
        border-radius: 12px;
    }

    .modal-content h2 {
        font-size: 1.2rem;
        margin-bottom: 16px;
    }

    .form-group {
        margin-bottom: 16px;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        max-width: none;
    }

    .close {
        font-size: 24px;
    }
}

/* ===== UTILITY ANIMATIONS ===== */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.form-group input:disabled {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ===== TRANSITIONS ===== */
.modal,
.modal-content,
.form-group input,
.close,
.form-actions .btn {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
