/* Mobile Form Enhancements */

/* Ensure forms are mobile-friendly */
@media (max-width: 768px) {
    /* Registration and login forms */
    .register-container,
    .login-container {
        padding: 1rem;
        min-height: calc(100vh - 70px);
    }
    
    .register-card,
    .login-card {
        margin: 0;
        border-radius: 1rem;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }
    
    .register-header,
    .login-header {
        padding: 1.5rem;
        border-radius: 1rem 1rem 0 0;
    }
    
    .register-title,
    .login-title {
        font-size: 1.5rem;
    }
    
    .register-subtitle,
    .login-subtitle {
        font-size: 0.875rem;
    }
    
    #registerForm,
    #loginForm,
    .login-form {
        padding: 1.5rem;
    }
    
    /* Form sections */
    .form-section {
        margin-bottom: 1.5rem;
        padding-bottom: 1.5rem;
    }
    
    .section-title {
        font-size: 1.125rem;
        margin-bottom: 0.75rem;
    }
    
    /* Form rows - stack on mobile */
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    /* Form inputs */
    .form-input,
    .form-control,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    textarea,
    select {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 0.5rem;
        -webkit-appearance: none; /* Remove iOS styling */
    }
    
    /* Labels */
    .form-label {
        font-size: 0.875rem;
        margin-bottom: 0.375rem;
    }
    
    /* Checkboxes and radios */
    .checkbox-label,
    .radio-label {
        display: flex;
        align-items: flex-start;
        gap: 0.5rem;
        font-size: 0.875rem;
        padding: 0.5rem 0;
    }
    
    input[type="checkbox"],
    input[type="radio"] {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
        margin-top: 2px;
    }
    
    /* Password requirements list */
    .password-requirements {
        font-size: 0.75rem;
        padding: 0.75rem;
    }
    
    .password-requirements ul {
        padding-left: 1.25rem;
    }
    
    /* Submit buttons */
    .btn-register,
    .btn-login,
    .login-btn,
    button[type="submit"] {
        width: 100%;
        padding: 0.875rem;
        font-size: 1rem;
        margin-top: 1rem;
    }
    
    /* User type toggle */
    .user-type-toggle {
        margin-bottom: 1.5rem;
    }
    
    .toggle-option {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    /* Account type notice */
    .account-type-notice {
        margin-bottom: 1.5rem;
        padding: 1rem;
        font-size: 0.875rem;
    }
    
    .notice-content {
        gap: 0.5rem;
    }
    
    .notice-content i {
        font-size: 1.125rem;
    }
    
    /* Error messages */
    .text-danger,
    .field-validation-error {
        font-size: 0.75rem;
        margin-top: 0.25rem;
    }
    
    /* Modal adjustments for forms */
    .modal-content.login-content {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    .modal-header {
        padding: 1.25rem;
    }
    
    .modal-title {
        font-size: 1.25rem;
    }
    
    .modal-subtitle {
        font-size: 0.875rem;
    }
    
    /* Close button positioning */
    .close-btn {
        top: 0.75rem;
        right: 0.75rem;
        width: 36px;
        height: 36px;
        font-size: 1.5rem;
    }
    
    /* Form options (Remember me, Forgot password) */
    .form-options {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
        margin: 1rem 0;
    }
    
    .remember-me {
        font-size: 0.875rem;
    }
    
    .forgot-password {
        font-size: 0.875rem;
    }
    
    /* Signup link */
    .signup-link,
    .login-link {
        font-size: 0.875rem;
        margin-top: 1.5rem;
    }
    
    /* School selection modal */
    .search-container {
        padding: 0 1rem;
        margin-bottom: 1rem;
    }
    
    .search-input {
        padding: 0.75rem 1rem 0.75rem 3rem;
        font-size: 16px;
    }
    
    .search-icon {
        left: 1rem;
        font-size: 1.125rem;
    }
    
    /* School list */
    .schools-list {
        max-height: 60vh;
        padding: 0 1rem;
    }
    
    .school-option {
        padding: 0.875rem;
        margin-bottom: 0.5rem;
        min-height: 60px;
    }
    
    .school-avatar {
        width: 40px;
        height: 40px;
        font-size: 0.875rem;
    }
    
    .school-details h3 {
        font-size: 0.9rem;
    }
    
    .school-details p {
        font-size: 0.75rem;
    }
    
    /* Loading states */
    .schools-loading {
        padding: 3rem 1rem;
    }
    
    .loading-spinner {
        width: 40px;
        height: 40px;
    }
    
    /* Error states */
    .schools-error {
        padding: 2rem 1rem;
        text-align: center;
    }
    
    .error-icon {
        font-size: 2.5rem;
        margin-bottom: 0.75rem;
    }
    
    .schools-error h3 {
        font-size: 1.125rem;
        margin-bottom: 0.5rem;
    }
    
    .schools-error p {
        font-size: 0.875rem;
        margin-bottom: 1rem;
    }
    
    /* Admin badge */
    .admin-badge {
        top: 0.5rem;
        right: 3rem;
        padding: 0.25rem 0.75rem;
        font-size: 0.75rem;
    }
}

/* Very small devices */
@media (max-width: 380px) {
    .register-header,
    .login-header {
        padding: 1.25rem;
    }
    
    .register-title,
    .login-title {
        font-size: 1.25rem;
    }
    
    #registerForm,
    #loginForm,
    .login-form {
        padding: 1.25rem;
    }
    
    .form-input,
    input,
    select,
    textarea {
        padding: 0.625rem 0.875rem;
    }
    
    .btn-register,
    .btn-login,
    button[type="submit"] {
        padding: 0.75rem;
        font-size: 0.9375rem;
    }
}

/* Touch-friendly form enhancements */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .form-input,
    input,
    select,
    textarea,
    .checkbox-label,
    .radio-label,
    .toggle-option {
        min-height: 44px;
    }
    
    /* Better spacing for touch */
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    /* Larger checkboxes and radios */
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
    }
    
    /* Remove hover effects */
    .form-input:hover,
    .btn:hover {
        transform: none;
    }
}

/* iOS-specific fixes */
@supports (-webkit-touch-callout: none) {
    /* Prevent zoom on input focus */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px !important;
    }
    
    /* Fix iOS button styling */
    button,
    input[type="submit"],
    input[type="button"] {
        -webkit-appearance: none;
        border-radius: 0.5rem;
    }
    
    /* Fix select dropdown arrow */
    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='M6 8L0 0h12z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 1rem center;
        padding-right: 2.5rem;
    }
}

/* Android-specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) and (hover: none) {
    /* Fix Android form input issues */
    input,
    textarea,
    select {
        -webkit-tap-highlight-color: transparent;
    }
}