:root {
    --primary: #059669;
    --primary-dark: #065f46;
    --primary-light: #34d399;
    --accent: #fbbf24;
    --bg-body: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.85);
    --text-main: #064e3b;
    --text-muted: #4b5563;
    --border-color: rgba(5, 150, 105, 0.15);
    --input-bg: rgba(255, 255, 255, 0.5);
    --focus-ring: rgba(5, 150, 105, 0.15);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-md: 0.75rem;
    --radius-lg: 1.25rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Hind Siliguri', 'Inter', sans-serif;
    background-color: var(--bg-body);
    background-image:
        radial-gradient(at 0% 0%, rgba(52, 211, 153, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(5, 150, 105, 0.1) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(110, 231, 183, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    padding: 3rem 1rem;
}

.main-container {
    max-width: 900px;
    margin: 0 auto;
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header Styles */
.form-header {
    background: linear-gradient(135deg, #065f46, #059669, #10b981);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header-content {
    width: 100%;
    z-index: 10;
}

.form-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="2" cy="2" r="2" fill="rgba(255,255,255,0.1)"/></svg>');
    opacity: 0.3;
}

.logo-area {
    margin: 0 auto 0.75rem;
    display: flex;
    justify-content: center;
}

.logo {
    height: 60px;
    width: auto;
    object-fit: contain;
    background: white;
    padding: 0.25rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.institution-info h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.22rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.institution-info .address {
    font-size: 0.85rem;
    opacity: 0.9;
    max-width: 500px;
    margin: 0.5rem auto 0;
    line-height: 1.4;
}

/* Form Styles */
.enrollment-form {
    padding: 2rem 2.5rem;
}

.form-title {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.form-title h2 {
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    font-size: 1.5rem;
    font-weight: 600;
}

.section {
    margin-bottom: 3rem;
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    animation: slideUp 0.6s ease-out forwards;
}

.section:nth-child(1) {
    animation-delay: 0.2s;
}

.section:nth-child(2) {
    animation-delay: 0.4s;
}

.section:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #f0fdf4, transparent);
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    border-left: 5px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.grid-2,
.grid-3,
.grid-4 {
    display: grid;
    gap: 1.5rem 2rem;
    margin-bottom: 0.5rem;
}

.grid-2 {
    grid-template-columns: 1fr 1fr;
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.full-width {
    grid-column: 1 / -1;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 1rem 1.25rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--input-bg);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-main);
    min-height: 52px;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.02);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--focus-ring), 0 10px 15px -3px rgba(5, 150, 105, 0.1);
    background-color: white;
    transform: translateY(-2px);
}

/* Radio Group as Buttons */
.radio-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.radio-group label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    transition: all 0.2s ease;
    text-align: center;
    margin-bottom: 0;
    min-height: 44px;
}

.radio-group input[type="radio"] {
    display: none;
}

.radio-group input[type="radio"]:checked+label {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.radio-group label:hover {
    border-color: var(--primary-light);
    background-color: #f0fdf4;
}

.radio-group input[type="radio"]:checked+label:hover {
    background-color: var(--primary-dark);
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px white inset !important;
    -webkit-text-fill-color: var(--text-main) !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Remove Date/Time Picker Icons */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    display: none;
    -webkit-appearance: none;
}

.help-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Buttons */
.form-footer {
    display: flex;
    justify-content: center;
    padding-top: 1rem;
}

.submit-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 1.25rem 4rem;
    border-radius: 9999px;
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.025em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 15px -3px rgba(5, 150, 105, 0.3), 0 4px 6px -2px rgba(5, 150, 105, 0.1);
}

.submit-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(5, 150, 105, 0.4), 0 10px 10px -5px rgba(5, 150, 105, 0.2);
    filter: brightness(1.1);
}

.submit-btn:active {
    transform: translateY(1px);
}

/* Footer */
.main-footer {
    background-color: #f9fafb;
    padding: 1.5rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    .enrollment-form {
        padding: 1.5rem;
    }

    .form-header {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }

    .form-header .header-photo {
        margin-top: 1rem;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .full-width {
        grid-column: span 1;
        margin-top: 0;
    }

    .form-footer {
        flex-direction: column;
        gap: 0.75rem;
    }

    .print-btn,
    .submit-btn {
        width: 100%;
        margin-right: 0;
    }
}



/* Declaration and Signature */
.declaration-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: #ecfdf5;
    /* Light emerald */
    border: 1px solid #6ee7b7;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.6;
    text-align: justify;
}

.declaration-section strong {
    color: #047857;
    font-weight: 700;
}

.signature-area {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 4rem;
    padding: 0 1rem;
}

.signature-box {
    margin-top: 2rem;
}

.signature-box.right {
    text-align: center;
    width: 250px;
}

.signature-box .line {
    border-top: 1px solid var(--text-main);
    margin-bottom: 0.75rem;
}

/* Admin Section (Student ID & Date) */
.admin-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: #f0fdf4;
    border: 1px dashed #6ee7b7;
    border-radius: var(--radius-md);
}

.admin-section label {
    color: #065f46;
    font-weight: 600;
}

.submit-btn:active {
    transform: translateY(1px);
}

/* ========== PRINT STYLES ========== */
@media print {

    /* Reset page margins and setup A4 layout */
    @page {
        size: A4;
        margin: 12mm 15mm;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        padding: 0;
        margin: 0;
        background: white;
        background-image: none;
        font-size: 9pt;
        line-height: 1.3;
    }

    .main-container {
        max-width: 100%;
        box-shadow: none;
        border: none;
        border-radius: 0;
        margin: 0;
        background: white;
    }

    /* Header adjustments for print */
    .form-header {
        padding: 14px 18px;
        margin-bottom: 16px;
        page-break-inside: avoid;
        background: linear-gradient(135deg, #059669, #047857) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .form-header::before {
        display: none;
    }

    .logo {
        height: 42px;
        background: white !important;
    }

    .institution-info h1 {
        font-size: 18pt;
        margin-bottom: 4px;
    }

    .institution-info .address {
        font-size: 7.5pt;
        line-height: 1.4;
    }

    .header-photo {
        flex-shrink: 0;
    }

    .photo-upload-container.compact {
        width: 105px;
        padding: 5px;
        background: white !important;
        border: 1px solid #e5e7eb;
    }

    .photo-upload-container.compact .photo-preview {
        height: 105px;
        margin-bottom: 0;
    }

    .upload-btn-sm {
        display: none;
    }

    /* Form content optimization */
    .enrollment-form {
        padding: 14px 18px;
    }

    .form-title {
        margin-bottom: 14px;
        padding-bottom: 8px;
    }

    .form-title h2 {
        font-size: 13pt;
        margin-bottom: 4px;
    }

    .form-title p {
        font-size: 7.5pt;
        margin-bottom: 0;
    }

    .section {
        margin-bottom: 14px;
        page-break-inside: avoid;
    }

    .section h3 {
        font-size: 9.5pt;
        margin-bottom: 8px;
        padding: 6px 14px;
        background-color: #f3f4f6 !important;
        border-left: 3px solid #059669 !important;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        gap: 8px 12px;
    }

    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }

    .form-group {
        margin-bottom: 5px;
    }

    .form-group label {
        font-size: 8pt;
        margin-bottom: 3px;
        font-weight: 600;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 5px 8px;
        font-size: 8.5pt;
        border: 1px solid #d1d5db !important;
        background-color: white !important;
        border-radius: 2px;
        min-height: 20px;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }

    .form-group select {
        background-image: none !important;
        padding-right: 7px !important;
    }

    .form-group textarea {
        min-height: 22px;
        resize: none;
    }

    /* Admin section */
    .admin-section {
        padding: 12px 14px;
        margin-bottom: 14px;
        background-color: #f0fdf4 !important;
        border: 1px dashed #6ee7b7 !important;
    }

    .admin-section label {
        color: #065f46 !important;
    }

    /* Declaration section */
    .declaration-section {
        margin: 14px 0;
        padding: 14px;
        font-size: 8pt;
        line-height: 1.6;
        background-color: #ecfdf5 !important;
        border: 1px solid #6ee7b7 !important;
        page-break-inside: avoid;
    }

    .declaration-section strong {
        color: #047857 !important;
    }

    .signature-area {
        margin-top: 20px;
        padding: 0 12px;
    }

    .signature-box {
        margin-top: 12px;
    }

    .signature-box p {
        font-size: 8pt;
    }

    .signature-box.right {
        width: 200px;
    }

    .signature-box .line {
        margin-bottom: 5px;
    }

    /* Hide elements not needed in print */
    .form-footer,
    .main-footer,
    .print-btn,
    .submit-btn {
        display: none !important;
    }

    /* Ensure no page breaks in critical sections */
    .form-header,
    .admin-section,
    .declaration-section {
        page-break-inside: avoid;
    }

    /* Prevent orphans and widows */
    p,
    h3,
    label {
        orphans: 3;
        widows: 3;
    }

    /* Ensure elements fit on page */
    img {
        max-width: 100%;
        page-break-inside: avoid;
    }
}