/**
 * Visit Booking System - CSS Styles
 * Google Form-inspired, mobile-first responsive design
 */

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

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.5rem;
    font-weight: 500;
    line-height: 1.3;
}

h1 {
    font-size: 2rem;
    font-weight: 400;
}

h2 {
    font-size: 1.5rem;
    font-weight: 500;
}

h3 {
    font-size: 1.25rem;
}

p {
    margin-bottom: 1rem;
}

/* Layout Components */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1rem;
}

.main-content {
    min-height: calc(100vh - 140px);
    padding: 2rem 0;
}

/* Navigation */
.navbar {
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: left;
    align-items: center;
}

.nav-title {
    font-size: 1.5rem;
    font-weight: 500;
    color: #1976d2;
    margin: 0;
}

.nav-logo {
    width: 8%;
    min-width: 50px;
    margin-right: 1rem;
}

.logout-container {
    margin-left: auto;
}

.logout-button {
    background: #f44336;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.2s;
}

.logout-button:hover {
    background: #d32f2f;
}

/* Cards */
.form-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 2rem;
    margin-bottom: 2rem;
}

.login-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

.disclaimer-card {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 2rem;
}

.disclaimer-card h3 {
    color: #856404;
    margin-bottom: 0.5rem;
}

.disclaimer-card p {
    color: #856404;
    margin: 0;
    font-size: 0.875rem;
}

/* Form Styling */
.form-title {
    color: #333;
    margin-bottom: 0.5rem;
}

.form-subtitle {
    color: #666;
    font-size: 1rem;
    margin-bottom: 2rem;
}

.login-title {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #333;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
    font-size: 0.875rem;
}

.required {
    color: #d32f2f;
    font-weight: bold;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    background-color: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

.form-input:disabled,
.form-select:disabled {
    background-color: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.form-input.error,
.form-select.error {
    border-color: #d32f2f;
    box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.2);
}

/* Error and Success Messages */
.error-text {
    color: #d32f2f;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    display: none;
}

.success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.success-message ul {
    margin: 10px 0;
    padding-left: 20px;
}

.success-message li {
    margin: 5px 0;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.info-message {
    background: #cce7ff;
    color: #004085;
    border: 1px solid #99d3ff;
    border-radius: 4px;
    padding: 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

.info-text {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

/* Buttons */
.submit-button,
.primary-button {
    background: #1976d2;
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
    font-weight: 500;
}

.submit-button:hover:not(:disabled),
.primary-button:hover:not(:disabled) {
    background: #1565c0;
}

.submit-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.secondary-button {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.secondary-button:hover {
    background: #e0e0e0;
}

.danger-button {
    background: #f44336;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.danger-button:hover {
    background: #d32f2f;
}

.small {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

/* Login Screen */
.login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px);
    padding: 2rem;
}

.login-form .form-group:last-of-type {
    margin-bottom: 2rem;
}

/* Admin Sections */
.admin-section {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.admin-section h2 {
    border-bottom: 2px solid #1976d2;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    color: #333;
}

/* School Types Manager */
.school-types-manager .form-group {
    display: flex;
    gap: 0.5rem;
    align-items: end;
}

.school-types-manager .form-input {
    flex: 1;
}

.school-types-list {
    margin-top: 1rem;
}

.school-type-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    background: #f9f9f9;
}

.school-type-name {
    font-weight: 500;
}

/* Date Manager */
.date-manager .form-row {
    align-items: end;
}

.dates-list {
    margin-top: 1rem;
}

.date-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    background: #f9f9f9;
}

.date-info strong {
    display: block;
    margin-bottom: 0.25rem;
}

.date-details {
    font-size: 0.875rem;
    color: #666;
}

.date-actions {
    display: flex;
    gap: 0.5rem;
}

/* Registrations */
.filter-controls {
    margin-bottom: 1.5rem;
}

.table-container {
    overflow-x: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.registrations-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.registrations-table th,
.registrations-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.registrations-table th {
    background: #f5f5f5;
    font-weight: 500;
    font-size: 0.875rem;
    color: #333;
}

.registrations-table tbody tr:hover {
    background: #f9f9f9;
}

/* Utilities */
.utilities {
    display: grid;
    gap: 1.5rem;
}

.utility-group h3 {
    margin-bottom: 1rem;
    color: #333;
}

.utility-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.utility-group h3 {
    width: 100%;
}

/* Footer */
.footer {
    background: #fff;
    border-top: 1px solid #e0e0e0;
    padding: 1.5rem 0;
    margin-top: auto;
    text-align: center;
    color: #666;
    font-size: 0.875rem;
}

/* Responsive Design */
@media (min-width: 768px) {
    .container {
        padding: 0 2rem;
    }
    
    .form-card {
        padding: 3rem;
    }
    
    .main-content {
        padding: 3rem 0;
    }
    
    .form-row {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .date-manager .form-row {
        grid-template-columns: 2fr 1fr 1fr auto;
    }
    
    .filter-controls .form-row {
        grid-template-columns: 1fr 1fr auto;
    }
    
    .submit-button,
    .primary-button {
        width: auto;
        min-width: 200px;
    }
    
    .school-types-manager .form-group {
        max-width: 400px;
    }
    
    .utility-group {
        flex-direction: row;
    }
    
    .utility-group h3 {
        width: auto;
        margin-right: 1rem;
        margin-bottom: 0;
    }
}

@media (min-width: 1024px) {
    .nav-container {
        padding: 0 2rem;
    }
    
    .date-item {
        align-items: flex-start;
    }
    
    .date-actions {
        flex-direction: row;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for better accessibility */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .form-input,
    .form-select {
        border-width: 2px;
    }
    
    .form-card,
    .admin-section {
        box-shadow: 0 0 0 2px #000;
    }
}

/* Print styles */
@media print {
    .navbar,
    .footer,
    .logout-button,
    .submit-button,
    .primary-button,
    .secondary-button,
    .danger-button {
        display: none;
    }
    
    .main-content {
        padding: 0;
    }
    
    .form-card,
    .admin-section {
        box-shadow: none;
        border: 1px solid #000;
    }
}

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

/* Animation for smooth transitions */
.form-input,
.form-select,
.submit-button,
.primary-button,
.secondary-button,
.danger-button {
    transition: all 0.2s ease;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}