* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.theme-paid {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
}

body.theme-pending {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

.enrollment-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    overflow: hidden;
}

.enrollment-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

body.theme-paid .enrollment-header {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
}

body.theme-pending .enrollment-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

.payment-notice {
    background: #fff7ed;
    border-bottom: 1px solid #fdba74;
    color: #9a3412;
    padding: 12px 20px;
    font-size: 14px;
    line-height: 1.5;
}

.logo-container {
    margin-bottom: 20px;
}

/* Update logo styles for image instead of text */
.logo-img {
    width: 100px;
    height: 100px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    object-fit: contain;
    background: white;
    padding: 8px;
}

.logo {
    display: inline-block;
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    color: #1e3a8a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.enrollment-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 14px;
    opacity: 0.9;
}

#formContainer {
    padding: 30px;
}

.form-section {
    margin-bottom: 30px;
}

.section-title {
    font-size: 20px;
    color: #1e3a8a;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.required {
    color: #ef4444;
}

.form-group input[type="text"],
.form-group input[type="tel"],
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
}

.form-group input[type="text"]:focus,
.form-group input[type="tel"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input[readonly] {
    background-color: #f9fafb;
    cursor: not-allowed;
}

.input-hint {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

.input-hint.hint-success {
    color: #059669;
}

.input-hint.hint-warning {
    color: #d97706;
}

.input-hint.hint-info {
    color: #2563eb;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.radio-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.radio-option:hover {
    border-color: #3b82f6;
    background-color: #f0f9ff;
}

.radio-option input[type="radio"] {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.radio-option.selected {
    border-color: #3b82f6;
    background-color: #dbeafe;
}

.option-tip {
    display: block;
    width: 100%;
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
    line-height: 1.3;
}

.district-btn {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s;
}

.district-btn:hover {
    border-color: #3b82f6;
}

.submit-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(30, 58, 138, 0.3);
}

.submit-btn:active {
    transform: translateY(0);
}

#loadingContainer {
    padding: 60px 30px;
    text-align: center;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding: 20px;
}

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

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    color: #1e3a8a;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    margin-bottom: 16px;
}

.district-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.district-item {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.district-item:hover {
    border-color: #3b82f6;
    background-color: #f0f9ff;
}

/* Responsive Design */
@media (max-width: 640px) {
    body {
        padding: 0;
    }

    .enrollment-container {
        border-radius: 0;
        min-height: 100vh;
    }

    .enrollment-header {
        padding: 30px 20px;
    }

    .enrollment-header h1 {
        font-size: 24px;
    }

    #formContainer {
        padding: 20px;
    }

    .section-title {
        font-size: 18px;
    }
    
    .radio-grid {
        grid-template-columns: 1fr;
    }
}

.success-content {
    text-align: center;
}

.success-content .status-remark {
    margin: 16px 0;
    padding: 12px 14px;
    border-radius: 8px;
    background: #f0fdf4;
    border-left: 4px solid #059669;
    color: #166534;
    font-size: 14px;
    line-height: 1.5;
    text-align: left;
}

.success-content .enrollment-action-buttons {
    margin-bottom: 12px;
}

.success-header {
    padding: 30px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: white;
    color: #10b981;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: bold;
    margin: 0 auto 20px;
}

.success-header h2 {
    font-size: 24px;
    margin: 0;
}

.success-details {
    padding: 30px 20px;
}

.reg-label {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 8px;
}

.reg-id {
    font-size: 24px;
    font-weight: bold;
    color: #1e3a8a;
    margin-bottom: 20px;
}

#barcodeContainer {
    margin: 20px 0;
    display: flex;
    justify-content: center;
}

.download-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 10px;
    transition: transform 0.2s;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.3);
}

.secondary-btn {
    width: 100%;
    padding: 16px;
    background: #f3f4f6;
    color: #374151;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: #e5e7eb;
}

.status-card {
    overflow: hidden;
}

.status-card-header {
    padding: 28px 24px;
    text-align: center;
    color: #fff;
}

body.theme-paid .status-card-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

body.theme-pending .status-card-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

.status-icon {
    width: 72px;
    height: 72px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    margin: 0 auto 16px;
}

body.theme-paid .status-icon {
    color: #059669;
}

body.theme-pending .status-icon {
    color: #1e3a8a;
}

.status-card-header h2 {
    font-size: 22px;
    margin: 0;
    line-height: 1.35;
}

.status-card-body {
    padding: 24px;
}

.status-details {
    text-align: center;
}

.payment-details-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
    text-align: left;
}

.payment-details-title {
    font-size: 16px;
    color: #1e3a8a;
    margin-bottom: 12px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #dbeafe;
    font-size: 14px;
    color: #374151;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row strong {
    color: #1e3a8a;
    text-align: right;
    word-break: break-word;
}

.status-remark {
    margin: 18px 0;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

body.theme-paid .status-remark {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

body.theme-pending .status-remark {
    background: #eff6ff;
    color: #1e3a8a;
    border: 1px solid #bfdbfe;
}

.payment-action-btn {
    display: inline-block;
    text-decoration: none;
    margin-bottom: 10px;
    text-align: center;
}

.download-btn-pending {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

.download-btn-pending:hover {
    box-shadow: 0 8px 16px rgba(30, 58, 138, 0.3);
}

body.theme-paid .reg-id {
    color: #059669;
}

body.theme-pending .reg-id {
    color: #1e3a8a;
}

body.theme-failed {
    background: linear-gradient(180deg, #fef2f2 0%, #fff7ed 100%);
}

body.theme-failed .enrollment-header {
    background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
}

body.theme-failed .status-card-header {
    background: linear-gradient(135deg, #b91c1c 0%, #ef4444 100%);
}

body.theme-failed .status-icon {
    background: rgba(255, 255, 255, 0.2);
}

body.theme-failed .status-remark {
    background: #fef2f2;
    border-left-color: #dc2626;
}

body.theme-failed .reg-id {
    color: #b91c1c;
}

.enrollment-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.rule-action-btn {
    width: 100%;
    text-align: center;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.file-preview-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.file-preview-modal.show {
    display: flex;
}

.file-preview-dialog {
    width: min(960px, 100%);
    max-height: 90vh;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.file-preview-header,
.file-preview-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.file-preview-footer {
    border-bottom: none;
    border-top: 1px solid #e2e8f0;
    justify-content: flex-end;
}

.file-preview-header button {
    border: none;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.file-preview-body {
    flex: 1;
    overflow: auto;
    background: #0f172a;
    min-height: 360px;
}

.file-preview-body iframe {
    width: 100%;
    height: 70vh;
    border: 0;
    background: #fff;
}

#filePreviewCardHost {
    padding: 16px;
    display: flex;
    justify-content: center;
}
