/* Base styles */
body {
    margin: 0;
    font-family: 'Segoe UI', sans-serif;
    background: #f4f8f9;
    color: #333;
    overflow: auto;
}

body.popup-open {
    overflow: hidden;
}

body.dark-mode {
    background: #121212;
    color: #e0e0e0;
}
body.dark-mode .popup-form {
    background: rgba(30, 30, 30, 0.85);
}
body.dark-mode .floating-group input,
body.dark-mode .floating-group textarea {
    background: #1e1e1e;
    border-color: #444;
    color: #e0e0e0;
}
body.dark-mode .floating-group label {
    background: #1e1e1e;
    color: #aaa;
}
body.dark-mode .floating-group.focused label,
body.dark-mode .floating-group input:focus + label,
body.dark-mode .floating-group textarea:focus + label {
    color: #80cbc4;
}

.site-content {
    text-align: center;
    padding: 80px 20px;
}
.site-content h1 { font-size: 32px; margin-bottom: 12px; }
.site-content p { font-size: 18px; color: #555; }

/* Popup overlay */
.popup-container {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}
.popup-container.show {
    display: flex;
}
.popup-container.show ~ body {
    overflow: hidden;
}

/* Popup form */
.popup-form {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 14px;
    box-shadow: 0 12px 28px rgba(0,0,0,0.2);
    position: relative;
    animation: fadeIn 0.4s ease-out;
    padding: 32px;
    transition: opacity 0.3s, transform 0.3s; /* Updated to 0.3s for smoother close */
}

/* Mobile and PC width adjustments */
@media (max-width: 600px) {
    .popup-form {
        width: 288px;
        height: auto;
        border-radius: 8px;
        padding: 30px 20px;
        justify-content: center;
        min-height: 400px;
    }
}

@media (min-width: 601px) {
    .popup-form {
        width: 30%;
        max-width: 700px;
        height: auto;
        min-height: 440px;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

.popup-container.closing {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

.close-btn {
    position: absolute;
    top: 14px;
    right: 18px;
    font-size: 20px;
    border: none;
    background: none;
    cursor: pointer;
    color: #555;
}

h2 {
    text-align: center;
    margin-bottom: 16px;
    color: #0F172A;
    font-size: 30px;
    font-weight: bold;
    margin-top: -8px;
}

/* Form Row */
.form-row {
    display: block;
    margin-bottom: 16px;
}
.form-row .floating-group,
.form-row .custom-select-group {
    width: 100%;
}

/* Input & Select Height Fix */
.floating-group input,
.custom-select {
    height: 52px;
    line-height: 20px;
    padding: 16px 12px 4px 12px;
    font-size: 16px;
    box-sizing: border-box;
}

/* Floating label base */
.floating-group,
.custom-select-group {
    position: relative;
    width: 100%;
}
.floating-group.full { width: 100%; }
.floating-group input,
.floating-group textarea {
    width: 100%;
    border: 1.5px solid #ccc;
    border-radius: 6px;
    background: #fff;
    outline: none;
    transition: border-color 0.2s ease;
}
.floating-group input:focus,
.floating-group textarea:focus { border-color: #0F172A; }
.floating-label {
    position: absolute;
    top: 50%;
    left: 12px;
    border-radius: 20px;
    transform: translateY(-50%);
    font-size: 16px;
    background: white;
    padding: 0 6px;
    color: #888;
    transition: 0.3s ease all;
    pointer-events: none;
}

/* Floating label dark when focused */
.floating-group.focused .floating-label,
.floating-group input:focus + .floating-label,
.floating-group textarea:focus + .floating-label,
.custom-select-group.focused .floating-label {
    top: 0;
    left: 10px;
    font-size: 13px;
    background: #333;
    color: #fff;
    border-radius: 4px;
}

/* Course dropdown */
.custom-select-group {
    position: relative;
    width: 100%;
}
.custom-select {
    display: flex;
    align-items: center;
    border: 1.5px solid #ccc;
    border-radius: 6px;
    background: #fff;
    transition: border-color 0.2s ease;
}
.custom-select.open,
.custom-select:focus { border-color: #0F172A; }
.selected-text {
    font-size: 16px;
    color: #333;
    visibility: hidden;
    opacity: 0;
    transition: 0.3s ease all;
}
.custom-select.open .selected-text,
.selected-text.selected {
    visibility: visible;
    opacity: 1;
}

/* Dropdown options */
.options {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    border: 1px solid #ccc;
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    position: absolute;
    width: 100%;
    top: 100%;
    left: 0;
    z-index: 10;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.25s ease-in-out;
}
.custom-select.open .options { display: block; }
.options li {
    padding: 5px 16px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

ul li {
    text-align: justify;
    margin-bottom: 8px;
    font-size: 16px;
}

.options li:hover,
.options li.active {
    background: #0F172A;
    color: white;
}

/* Submit button */
button[type="submit"] {
    width: 100%;
    padding: 14px;
    font-size: 18px;
    color: #fff;
    background: #3b4ef8;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 30px;
    display: block;
}

button#submitBtn {
    position: relative;
    overflow: hidden;
}

/* Loader */
.loader {
    width: 18px;
    height: 18px;
    border: 3px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
}
.btn-text {
    transition: opacity 0.2s;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Success/Error messages */
.form-status {
    margin-top: -10px;
    margin-bottom: 10px;
    font-size: 15px;
    text-align: center;
}
.success-msg { color: green;
font-weight: bold;
max-height: 6px
}
.error-msg { color: red;
font-weight: bold;
max-height: 6px
}

/* Responsive layout */
@media (max-width: 480px) {
    .popup-form { padding: 20px 16px; }
}

button[type="submit"]:hover {
    background: #2f3bcc;
    transform: scale(1.03);
}

/* Success Popup */
.success-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 14px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
    padding: 20px;
    z-index: 10000;
    text-align: center;
    opacity: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 300px;
    height: 200px;
}

.success-content h2 {
    font-size: 24px;
    color: #2ecc71;
    margin-bottom: 10px;
}

.success-content p {
    font-size: 16px;
    color: #333;
}

.close-success {
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 16px;
    color: #fff;
    background: #2ecc71;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.close-success:hover {
    background: #27ae60;
}