/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8fafc;
    min-height: 100vh;
    /* Sticky-footer layout: header/footer keep their natural height,
       main-content stretches to fill whatever space is left so a short
       page never shows a slab of plain body background below the footer. */
    display: flex;
    flex-direction: column;
}

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
    border-radius: 4px;
}

.skip-link:focus {
    top: 6px;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header Styles */
.site-header {
    background: white;
    padding: 0.5rem 0 0;
    border-bottom: 1px solid #000;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-direction: row;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    justify-content: center;
}

.logo {
    width: auto;
    max-width: 120px;
    height: 60px;
    object-fit: contain;
    margin-bottom: 0.5rem;
    border-radius: 4px;
}

.institution-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    justify-content: center;
}

.header-logo {
    width: auto;
    max-width: 80px;
    height: 60px;
    object-fit: contain;
    flex-shrink: 0;
}

.institution-text {
    text-align: left;
}

.institution-name {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: #f06e23;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.institution-subtitle {
    font-size: 0.95rem;
    font-weight: 300;
    color: #132347;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    .site-header {
        padding: 0.85rem 0;
    }

    /* header.php sets justify-content:space-between as an inline style,
       which beats a plain stylesheet rule - !important is needed here.
       Stacking the logo row above the sign-in/account button (instead of
       forcing both onto one cramped row) is what actually fixes the
       crowding - there's no width left over for both side by side once
       the logo+name+tagline row exists at a readable size. */
    .header-content {
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.6rem;
    }

    /* Keep the same left-logo, text-beside layout as desktop, just
       smaller - stacking logo/name/tagline on top of each other wasted
       vertical space and looked nothing like the PC view. */
    .institution-info {
        flex-direction: row;
        gap: 0.6rem;
        text-align: left;
    }

    .institution-text {
        text-align: left;
    }

    .header-logo {
        max-width: 48px;
        height: 40px;
    }

    .institution-name {
        font-size: 1.15rem;
        margin-bottom: 0.1rem;
    }

    .institution-subtitle {
        font-size: 0.75rem;
    }
}

/* Main Content */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
    flex: 1 0 auto;
}

/* Form Container */
.form-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin: 2rem auto;
    max-width: 1200px;
    width: 95%;
}

.header-content {
    text-align: center;
    margin-bottom: 0.5rem;
}

.form-logo {
    max-width: 120px;
    height: auto;
    margin-bottom: 1rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Quick Links */
.quick-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1.5rem 0 2rem 0;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.quick-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #f06e23 0%, #132347 100%);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(240, 110, 35, 0.2);
}

.quick-link:hover {
    background: linear-gradient(135deg, #d9590e 0%, #0b1730 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(240, 110, 35, 0.3);
    color: white;
    text-decoration: none;
}

.quick-link:first-child {
    background: linear-gradient(135deg, #1c3a6e 0%, #132347 100%);
    box-shadow: 0 2px 4px rgba(19, 35, 71, 0.2);
}

.quick-link:first-child:hover {
    background: linear-gradient(135deg, #132347 0%, #0b1730 100%);
    box-shadow: 0 4px 8px rgba(19, 35, 71, 0.3);
}

.form-title {
    text-align: center;
    color: #132347;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    margin-right: auto;
}

/* Form Sections */
.form-section {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fafbfc;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 1rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid #d1d5db;
}

/* Form Grid */
.form-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr 1fr 1fr;
    /* Default 3-column layout */
}

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

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

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

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

/* Form Groups */
.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

/* Labels */
label {
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.required::after {
    content: " *";
    color: #ef4444;
}

/* Form Controls */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="datetime-local"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background-color: white;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #f06e23;
    box-shadow: 0 0 0 3px rgba(240, 110, 35, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* File Input */
input[type="file"] {
    width: 100%;
    padding: 0.5rem;
    border: 2px dashed #d1d5db;
    border-radius: 6px;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="file"]:hover {
    border-color: #f06e23;
    background: #fff1e6;
}

/* Checkbox and Radio Groups */
.checkbox-group,
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkbox-item,
.radio-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    margin: 0;
    transform: scale(1.2);
}

/* Declaration checkbox alignment */
.checkbox-group {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.5rem;
    text-align: left;
}

.checkbox-group input[type="checkbox"] {
    margin-top: 0.2rem;
    flex-shrink: 0;
}

/* Arrow List Styling */
.arrow-list {
    list-style: none;
    padding-left: 0;
    margin: 1rem 0;
}

.arrow-list li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.arrow-list li::before {
    content: "→";
    position: absolute;
    left: 0;
    top: 0;
    color: #f06e23;
    font-weight: bold;
    font-size: 1.1rem;
}

/* Submit Button */
.submit-section {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid #e5e7eb;
}

.btn-submit {
    background: linear-gradient(332deg, #f06e23 12.4%, #132347 73.65%);
    color: white;
    padding: 1rem 3rem;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px -3px rgba(0, 0, 0, 0.2);
}

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

.submit-note {
    margin-top: 1rem;
    text-align: center;
}

.submit-note p {
    font-size: 0.8rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
}

/* Loading State */
.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Error Messages */
.error-message {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

.error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

/* Success Messages */
.success-message {
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    animation: slideIn 0.3s ease-out;
}

/* Alert Messages */
.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    animation: slideIn 0.3s ease-out;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.alert-success {
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    color: #166534;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form Enhancements */
.form-group small {
    color: #6b7280;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    display: block;
}

/* Photo Preview */
#photo-preview {
    max-width: 150px;
    max-height: 150px;
    margin-top: 10px;
    border-radius: 8px;
    border: 2px solid #d1d5db;
    object-fit: cover;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Help Button and Text Styles */
.help-btn {
    background: linear-gradient(332deg, #f06e23 12.4%, #132347 73.65%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    margin-left: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    vertical-align: middle;
}

.help-btn:hover {
    background: #d9590e;
    transform: scale(1.1);
}

.help-icon {
    font-size: 14px;
    line-height: 1;
}

.help-text {
    margin-top: 0.5rem;
    display: block;
}

.help-link {
    color: #f06e23;
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.3s ease;
}

.help-link:hover {
    color: #d9590e;
    text-decoration: underline;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal.show {
    display: block !important;
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, #132347 0%, #f06e23 100%);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s ease;
    line-height: 1;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 2rem;
    line-height: 1.6;
}

.priority-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
}

.priority-section h3 {
    color: #132347;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.priority-section p {
    margin-bottom: 0.75rem;
    color: #374151;
}

.important-notes {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.important-notes h3 {
    color: #92400e;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.note-item {
    margin-bottom: 1.5rem;
}

.note-item:last-child {
    margin-bottom: 0;
}

.note-item h4 {
    color: #92400e;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.note-item p {
    color: #451a03;
    margin-bottom: 0.5rem;
}

.note-item ul {
    margin-left: 1.5rem;
    color: #451a03;
}

.note-item li {
    margin-bottom: 0.5rem;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.btn-close {
    background: #6b7280;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-close:hover {
    background: #4b5563;
    transform: translateY(-1px);
}

/* Mobile Responsive Modal */
@media (max-width: 768px) {
    .modal-content {
        margin: 5% auto;
        width: 95%;
        max-height: 85vh;
    }

    .modal-header {
        padding: 1rem 1.5rem;
    }

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

    .modal-body {
        padding: 1.5rem;
    }

    .priority-section {
        padding: 1rem;
    }

    .important-notes {
        padding: 1rem;
    }

    .help-btn {
        width: 20px;
        height: 20px;
        font-size: 11px;
    }
}

/* Footer Styles */
.site-footer {
    background: #374151;
    color: white;
    padding: 2rem 0;
    text-align: center;
}

.footer-content p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.footer-content p:first-child {
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 0.75rem;
    }

    .form-container {
        margin: 1rem auto;
        padding: 1.5rem;
        border-radius: 8px;
    }

    .quick-links {
        flex-direction: column;
        gap: 0.75rem;
        margin: 1rem 0;
        padding: 0.75rem;
    }

    .quick-link {
        justify-content: center;
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }

    .form-title {
        font-size: 1.25rem;
    }

    .form-grid {
        grid-template-columns: 1fr 1fr;
        /* 2-column on tablet */
    }

    .form-grid.four-column {
        grid-template-columns: 1fr 1fr;
        /* 2-column on tablet for 4-column sections */
    }

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

    .logo-section {
        flex-direction: column;
        text-align: center;
        width: 100%;
        padding: 0 1rem;
    }

    .logo {
        width: 100%;
        max-width: 100%;
        height: auto;
    }

    .institution-name {
        font-size: 1.5rem;
    }

    .institution-subtitle {
        font-size: 0.875rem;
    }

    .form-section {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .logo-section {
        flex-direction: column;
        gap: 0.5rem;
    }

    .logo {
        max-width: 80px;
        height: 40px;
    }

    .institution-name {
        font-size: 1.25rem;
    }

    .institution-subtitle {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .form-container {
        padding: 1rem;
    }

    .btn-submit {
        width: 100%;
        padding: 1rem;
    }

    .logo {
        max-width: 60px;
        height: 30px;
    }

    .institution-name {
        font-size: 1.25rem;
    }

    .form-grid,
    .form-grid.two-column,
    .form-grid.three-column,
    .form-grid.four-column {
        grid-template-columns: 1fr !important;
        /* Single column on mobile */
    }

    .header-content {
        padding-bottom: 0.5rem;
    }

    .form-logo {
        max-width: 80px;
    }


}

.header-button .find-btn {
    background-color: #f06e23;
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.header-button .find-btn:hover {
    background-color: #d9590e;
}