/* Fonts */
@font-face {
    font-family: 'arabic1';
    src: url('../fonts/BalooBhaijaan2-Medium.ttf') format('truetype');
}
@font-face {
    font-family: 'english1';
    src: url('../fonts/VarelaRound-Regular.ttf') format('truetype');
}

/* Variables for consistent styling */
:root {
    --text-color: #ffffff;
    --muted-text: #a8a8b9;
    --input-border: rgba(255, 255, 255, 0.4);
    --input-bg: rgba(255, 255, 255, 0.08);
    --input-bg-focus: rgba(255, 255, 255, 0.15);
    --button-bg: rgba(255, 255, 255, 0.08);
    --focus-glow: 0 0 8px rgba(0, 0, 0, 0.4);
    --green-bg: #006400;
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-strong: 0 4px 12px rgba(0, 0, 0, 0.3);
    --text-shadow: 0px 0px 4px rgba(0, 0, 0, 0.6);
}

/* Media Queries */
@media screen and (max-height: 700px) {
    .divForm { 
        transform: scale(0.85);
        transform-origin: top center;
        margin: 2vh auto;
    }
}
@media screen and (max-height: 500px) and (orientation: landscape),
       screen and (max-height: 400px) and (orientation: landscape) {
    .divForm { 
        transform: scale(0.54);
        margin: 2vh auto; /* Minimal margin for very small screens */
    }
}
@media screen and (max-height: 500px) {
    .divForm { 
        transform: scale(0.75);
        transform-origin: top center;
        margin: 1vh auto;
    }
}

/* Media Queries - Updated for better responsiveness */
@media screen and (max-width: 480px) {
    .divForm {
        width: 95%;
        padding: 20px;
        margin: 3vh auto;
        border-radius: 20px;
    }
    
    /* Adjust form fields for small screens */
    input,
    .sex-select,
    .department-select,
    .designation-select,
    #stateOfOrigin,
    .institution-search,
    .form-control {
        width: 50%;
        max-width: none;
    }
    
    h1 {
        font-size: 260%;
        margin: 20px -10px 40px -10px;
    }
}

/* Hover effects - consolidated */
@media (hover: hover) {
    .logoAnimation:hover {
        opacity: 0.8;
        transform: scale(1.1);
    }
    
    input:hover,
    .sex-select:hover,
    .department-select:hover,
    .designation-select:hover,
    #stateOfOrigin:hover,
    .institution-search:hover,
    .form-control:hover {
        background-color: rgba(255, 255, 255, 0.2);
    }
    
    input:hover::placeholder,
    .institution-search:hover::placeholder {
        color: rgba(255, 255, 255, 0);
    }
    
    button:hover {
        background: rgba(255, 255, 255, 0.18);
        color: rgba(255, 255, 255, 0.8);
        transform: scale(1.06);
        box-shadow: var(--shadow-medium);
    }
    
    .mainb:hover {
        background: rgba(255, 255, 255, 0.4);
        transform: scale(1.08);
    }
    
    .b1:hover { background: rgba(255, 0, 0, 0.05); }
    .b2:hover { background: rgba(0, 0, 255, 0.05); }
    .showHideImage:hover { opacity: 0.5; }
}

/* Logo Animation */
.logoAnimation {
    position: absolute;
    top: 15px;
    left: 15px;
    height: 38px;
    opacity: 0.4;
    transition: transform 0.2s ease, opacity 0.3s ease;
}
.logoAnimation:active {
    opacity: 1;
    transform: scale(0.94);
}

/* Form layout */
form {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.divForm {
    color: var(--text-color);
    padding: 30px;
    width: 90%; /* More responsive width */
    max-width: 440px;
    min-width: auto; /* Remove fixed min-width */
    margin: 4vh auto;
    display: flex;
    flex-direction: column;
    text-align: center;
    border-radius: 30px;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(15px);
    transition: transform 0.1s;
    box-shadow: var(--shadow-medium);
    box-sizing: border-box; /* Include padding in width calculation */
    max-height: 90vh; /* Prevent vertical overflow */
    overflow-y: auto; /* Add scrolling if needed */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent; /* Firefox */
}

/* WebKit browsers (Chrome, Safari, Edge) */
.divForm::-webkit-scrollbar {
    width: 6px;
}

.divForm::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    margin: 10px 0;
}

.divForm::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    transition: background 0.3s ease;
}

.divForm::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

h1 {
    margin: 30px -20px 60px -20px;
    font-size: 340%;
    color: var(--muted-text);
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Shared Input/Button Styles */
input, button, select, .form-control, .institution-search {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* Common form controls styling */
input,
.sex-select,
.department-select,
.designation-select,
#stateOfOrigin,
.institution-search,
.form-control {
    width: 90%;
    max-width: 300px;
    color: var(--text-color);
    margin-bottom: 15px;
    padding: 10px 15px;
    border: 1px solid var(--input-border);
    border-radius: 5px;
    font-size: 16px;
    background: var(--input-bg);
    transition: border 0.1s, background 0.3s, transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.08);
    text-shadow: var(--text-shadow);
}

/* Enhanced Select Elements Styling */
.sex-select,
.department-select,
.designation-select,
#stateOfOrigin {
    /* Base styling improvements */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='white' viewBox='0 0 16 16'><path d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/></svg>");
    background-repeat: no-repeat;
    background-position: calc(100% - 15px) center;
    background-size: 12px;
    padding-right: 35px !important;
    cursor: pointer;
    transition: all 0.3s ease;
    max-height: 45px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Custom Scrollbar for Select Dropdowns (works in Webkit browsers) */
.sex-select option,
.department-select option,
.designation-select option,
#stateOfOrigin option {
    background-color: #006400;
    color: var(--text-color);
    padding: 8px 10px;
    max-height: fit-content;
}

/* Modify select wrappers to ensure proper width */
.sex-wrapper,
.department-wrapper,
.designation-wrapper,
.state-wrapper {
    width: 90%;
    max-width: 300px;
    margin-bottom: 20px;
}

/* Firefox scrollbar styling */
select {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(0, 100, 0, 0.2);
}

/* WebKit browsers (Chrome, Safari, Edge) - affects select popup in some browsers */
select::-webkit-scrollbar {
    width: 5px;
}

select::-webkit-scrollbar-track {
    background: rgba(0, 100, 0, 0.2);
    border-radius: 10px;
}

select::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

select::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Enhanced select focus state */
.sex-select:focus,
.department-select:focus,
.designation-select:focus,
#stateOfOrigin:focus {
    background-color: var(--green-bg);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='white' viewBox='0 0 16 16'><path d='M7.247 4.86 2.451 10.342C1.885 10.987 2.345 12 3.204 12h9.592a1 1 0 0 0 .753-1.659l-4.796-5.48a1 1 0 0 0-1.506 0z'/></svg>");
    border-color: rgba(255, 255, 255, 0.6);
}

/* Make select text more visible */
.sex-select option:checked,
.department-select option:checked,
.designation-select option:checked,
#stateOfOrigin option:checked {
    background: #005000;
    color: white;
    font-weight: 500;
}

/* Better disabled option styling */
select option:disabled {
    color: rgba(255, 255, 255, 0.4);
}

/* Focus styles for all form elements */
input:focus,
button:focus,
.sex-select:focus,
.department-select:focus,
.designation-select:focus,
#stateOfOrigin:focus,
.institution-search:focus,
.form-control:focus {
    outline: none;
    transform: scale(1.04);
    box-shadow: var(--focus-glow);
}

/* Special focus states for select elements */
.sex-select:focus,
.department-select:focus,
.designation-select:focus,
#stateOfOrigin:focus {
    background-color: var(--green-bg);
}

input::placeholder,
.institution-search::placeholder {
    text-shadow: none;
    color: rgba(255, 255, 255, 0.2);
    transition: color 0.8s;
}

input:focus::placeholder,
institution-search:focus::placeholder {
    color: rgba(255, 255, 255, 0);
}

/* Autofill styling */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-text-fill-color: #ffffff80;
    transition: background-color 5000s ease-in-out 0s;
}

/* Button Styles */
button {
    margin-top: 20px;
    padding: 6px;
    width: fit-content;
    min-width: 108px;
    border: none;
    border-radius: 10px;
    text-shadow: var(--text-shadow);
    background: var(--button-bg);
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    align-self: center;
    text-align: center;
    box-shadow: var(--shadow-light);
    transition: background-color 0.3s, color 0.3s, transform 0.2s, box-shadow 0.3s;
    white-space: nowrap;
}

button:active {
    background: var(--button-bg);
    color: white;
}

/* Main Submit Button */
.mainb {
    font-size: 18px;
    margin-top: 20px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.2);
}

.mainb:active { transform: scale(0.9); }

/* Additional Buttons */
.divb1b2 {
    width: 100%;
    margin-top: 46px;
    margin-bottom: -10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.b1:active, .b2:active { transform: scale(0.9); }
.b1:active { background: rgba(255, 0, 0, 0.1); }
.b2:active { background: rgba(0, 0, 255, 0.1); }

/* Error Messages */
.errorMessageDiv {
    width: 90%;
    max-width: 320px;
    text-align: -webkit-auto;
}

.errorMessage {
    visibility: visible;
    margin: -2% -2px 2.4% -2px;
    color: rgba(255, 255, 255, 0.2);
    font-size: smaller;
}

/* Password Input and Icon */
.password-wrapper {
    width: 101%;
    max-width: 332px;
    margin-bottom: 15px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.password-wrapper input { margin-bottom: 0; }

.showHideImage {
    width: 30px;
    height: 30px;
    position: absolute;
    right: 6%;
    bottom: 21%;
    opacity: 0.3;
    transition: transform 0.2s, opacity 0.4s, margin 0.2s;
}

#i2:focus + .showHideImage {
    transform: scale(1.14);
    margin: 0 -4px;
}

.showHideImage:focus { opacity: 0.3; }
.showHideImage:active {
    opacity: 1;
    transform: scale(0.9);
}

/* Common wrapper styles for form sections */
.sex-wrapper,
.institution-wrapper,
.department-wrapper,
.designation-wrapper,
.state-wrapper,
.folio-wrapper,
.phone-wrapper {
    width: 90%;
    max-width: 90%;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* Common label styles */
.department-label,
.designation-label,
.state-label,
.form-floating label {
    margin-bottom: 5px;
    color: var(--muted-text);
    font-size: 14px;
    transition: color 0.3s ease;
}

.form-floating label span { color: red; }
.form-floating input:focus + label { color: var(--text-color); }

/* Institution dropdown */
.institution-wrapper { position: relative; }

.custom-dropdown {
    display: none;
    border: 1px solid var(--input-border);
    border-radius: 5px;
    max-height: 150px;
    overflow-y: auto;
    background: #006400;
    color: var(--text-color);
    position: absolute;
    z-index: 1000;
    width: 100%;
    top: 100%;
    margin-top: 5px;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.08);
    text-shadow: var(--text-shadow);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(0, 100, 0, 0.2);
}

.custom-dropdown::-webkit-scrollbar {
    width: 5px;
}

.custom-dropdown::-webkit-scrollbar-track {
    background: rgba(0, 100, 0, 0.2);
    border-radius: 10px;
}

.custom-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.custom-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.dropdown-item {
    padding: 10px;
    cursor: pointer;
    transition: background 0.3s, color 0.3s;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-color);
}

.dropdown-item:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.3);
    color: var(--text-color);
}

/* Improved responsive scaling for smoother transitions */
.divForm {
    transition: transform 0.3s ease-out;
}

@media screen and (max-height: 700px) {
    .divForm { 
        transform: scale(0.85);
        transform-origin: top center;
        margin: 2vh auto;
    }
}

@media screen and (max-height: 500px) {
    .divForm { 
        transform: scale(0.75);
        transform-origin: top center;
        margin: 1vh auto;
    }
}

