/* Public Form CSS - Modern & Responsive */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    min-height: 100vh;
    padding: 20px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.page-container {
    max-width: 900px;
    margin: 0 auto;
}

.banner {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.banner img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 200px;
    object-fit: cover;
}

.form-container {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.form-header {
    text-align: center;
    margin-bottom: 40px;
}

.form-header h1 {
    color: #333;
    font-size: 32px;
    margin-bottom: 10px;
}

.form-header p {
    color: #666;
    font-size: 16px;
}

.registration-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Single field rows take full width */
.form-row:has(.form-group:only-child) {
    grid-template-columns: 1fr;
}

/* State, District, Block, and Address rows take full width */
#district-row,
#block-row {
    grid-template-columns: 1fr;
}

.form-row:has(#state_id),
.form-row:has(#address) {
    grid-template-columns: 1fr;
}

.form-group {
    display: flex;
    flex-direction: column;
}

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

.form-group .required {
    color: #e74c3c;
    margin-left: 2px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    font-family: inherit;
    width: 100%;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #f6d365;
    box-shadow: 0 0 0 3px rgba(246, 211, 101, 0.1);
}

.form-group input.error,
.form-group select.error {
    border-color: #e74c3c;
}

.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23333' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.form-group select:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
}

.error-message {
    color: #e74c3c;
    font-size: 13px;
    margin-top: 5px;
    display: none;
}

.checkbox-group {
    margin-top: 10px;
    padding: 16px;
    background: #fef9e7;
    border: 2px solid #f6d365;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
}

.checkbox-group::before {
    content: "⚠️";
    position: absolute;
    top: -12px;
    left: 12px;
    background: #fff;
    padding: 0 8px;
    font-size: 18px;
}

.checkbox-group.error {
    background: #fee;
    border-color: #e74c3c;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-weight: normal !important;
    position: relative;
}

.checkbox-label input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin-right: 10px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: #f6d365;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.checkbox-label input[type="checkbox"]:hover {
    transform: scale(1.1);
}

.checkbox-label input[type="checkbox"]:checked {
    transform: scale(1.05);
}

.checkbox-label input[type="checkbox"]:focus {
    outline: 2px solid #f6d365;
    outline-offset: 2px;
}

/* Change icon when checked */
.checkbox-group:has(input[type="checkbox"]:checked)::before {
    content: "✅";
}

.checkbox-group:has(input[type="checkbox"]:checked) {
    background: #e8f8f5;
    border-color: #27ae60;
}

.checkbox-label span {
    color: #555;
    line-height: 1.5;
    font-weight: 500;
}

.checkbox-group .error-message {
    margin-top: 8px;
    margin-left: 30px;
    font-weight: 600;
}

.form-actions {
    margin-top: 20px;
    text-align: center;
}

.btn {
    padding: 14px 40px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    color: #333;
    font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(246, 211, 101, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

/* Confetti canvas - must be above modal */
canvas.confetti-canvas {
    position: fixed !important;
    z-index: 9999 !important;
    pointer-events: none !important;
}

.modal-content {
    background-color: #fff;
    border-radius: 12px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

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

.modal-body {
    text-align: center;
}

.modal-body img {
    max-width: 200px;
    margin-bottom: 20px;
}

.success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    color: #333;
    font-size: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.modal-body h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 28px;
}

.modal-body p {
    color: #666;
    margin-bottom: 30px;
    font-size: 16px;
    line-height: 1.6;
}

/* Responsive Design - Tablet and Mobile */

/* Tablets (Portrait and Landscape) */
@media screen and (max-width: 1024px) {
    .page-container {
        max-width: 100%;
    }

    .form-container {
        padding: 30px;
    }

    .form-header h1 {
        font-size: 28px;
    }
}

/* Tablets (Portrait) and Large Phones (Landscape) */
@media screen and (max-width: 768px) {
    body {
        padding: 10px;
    }

    .page-container {
        max-width: 100%;
    }

    .banner {
        margin-bottom: 20px;
        border-radius: 8px;
    }

    .banner img {
        max-height: 150px;
    }

    .form-container {
        padding: 20px;
        border-radius: 8px;
    }

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

    .form-header h1 {
        font-size: 24px;
        line-height: 1.3;
    }

    .form-header p {
        font-size: 14px;
    }

    /* All form rows become single column on tablets */
    .form-row {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }

    .form-group label {
        font-size: 13px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 11px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .btn {
        padding: 12px 35px;
        font-size: 15px;
        width: 100%;
    }

    .modal-content {
        padding: 30px 20px;
        width: 95%;
    }

    .modal-body h2 {
        font-size: 22px;
    }

    .modal-body p {
        font-size: 14px;
    }

    .success-icon {
        width: 60px;
        height: 60px;
        font-size: 35px;
    }
}

/* Mobile Phones (Portrait and small devices) */
@media screen and (max-width: 480px) {
    body {
        padding: 8px;
    }

    .banner {
        border-radius: 6px;
        margin-bottom: 15px;
    }

    .banner img {
        max-height: 120px;
        border-radius: 6px;
    }

    .form-container {
        padding: 16px;
        border-radius: 6px;
    }

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

    .form-header h1 {
        font-size: 20px;
        line-height: 1.3;
        margin-bottom: 8px;
    }

    .form-header p {
        font-size: 13px;
        line-height: 1.4;
    }

    .registration-form {
        gap: 15px;
    }

    .form-row {
        gap: 12px;
    }

    .form-group label {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 6px;
    }

    .checkbox-label {
        font-size: 13px;
    }

    .checkbox-label input[type="checkbox"] {
        width: 20px;
        height: 20px;
        margin-right: 8px;
    }

    .checkbox-group {
        padding: 14px;
    }

    .checkbox-group::before {
        font-size: 16px;
        top: -10px;
    }

    .checkbox-label span {
        font-size: 13px;
        line-height: 1.4;
    }

    .form-actions {
        margin-top: 15px;
    }

    .btn {
        padding: 12px 30px;
        font-size: 15px;
        width: 100%;
        border-radius: 6px;
    }

    .modal-content {
        padding: 25px 16px;
        width: 95%;
        border-radius: 8px;
    }

    .modal-body h2 {
        font-size: 20px;
        margin-bottom: 12px;
    }

    .modal-body p {
        font-size: 14px;
        margin-bottom: 20px;
    }

    .success-icon {
        width: 50px;
        height: 50px;
        font-size: 30px;
        margin-bottom: 15px;
    }

    .error-message {
        font-size: 12px;
    }
}

/* Extra Small Devices */
@media screen and (max-width: 360px) {
    body {
        padding: 5px;
    }

    .form-container {
        padding: 12px;
    }

    .form-header h1 {
        font-size: 18px;
    }

    .form-header p {
        font-size: 12px;
    }

    .form-group label {
        font-size: 12px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 9px 10px;
        font-size: 15px;
    }

    .btn {
        padding: 10px 25px;
        font-size: 14px;
    }
}

/* Landscape orientation optimization */
@media screen and (max-height: 600px) and (orientation: landscape) {
    body {
        padding: 10px;
    }

    .form-header {
        margin-bottom: 15px;
    }

    .form-header h1 {
        font-size: 20px;
    }

    .form-header p {
        font-size: 12px;
    }

    .registration-form {
        gap: 12px;
    }

    .form-row {
        gap: 10px;
    }

    .banner {
        margin-bottom: 12px;
    }

    .banner img {
        max-height: 80px;
    }
}

/* High DPI / Retina Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .form-group input,
    .form-group select,
    .form-group textarea {
        border-width: 1.5px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .form-group input,
    .form-group select,
    .form-group textarea {
        min-height: 44px; /* iOS touch target minimum */
    }

    .btn {
        min-height: 44px;
    }

    .checkbox-label input[type="checkbox"] {
        min-width: 22px;
        min-height: 22px;
    }
}
