/* ============================================================================
   IEP Accommodation Library - Main Styles
   ============================================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1e40af;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #0ea5e9;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    font-size: 14px;
}

/* ============================================================================
   Header & Navigation
   ============================================================================ */

.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 2rem 1rem;
    box-shadow: var(--shadow-md);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
}

.header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.header p {
    font-size: 0.95rem;
    opacity: 0.95;
    margin-bottom: 1rem;
}

.nav-tabs {
    display: flex;
    gap: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 1rem;
}

.nav-tab {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.1);
}

.nav-tab:hover,
.nav-tab.active {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

/* ============================================================================
   Layout Containers
   ============================================================================ */

.search-container,
.tracker-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content,
.tracker-container > main {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 2rem 1rem;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

@media (max-width: 768px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .filters-sidebar {
        order: 2;
    }
    
    .results-section {
        order: 1;
    }
}

/* ============================================================================
   Search Section
   ============================================================================ */

.search-section {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 1rem;
}

.search-box {
    display: flex;
    gap: 0.75rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-btn {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.search-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-300);
    border-top: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
}

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.suggestion-item:hover {
    background: var(--gray-100);
}

/* ============================================================================
   Filters Sidebar
   ============================================================================ */

.filters-sidebar {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    height: fit-content;
    position: sticky;
    top: 1rem;
}

.filters-sidebar h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--gray-200);
}

.filter-group {
    margin-bottom: 1.25rem;
}

.filter-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.filter-input {
    width: 100%;
    padding: 0.65rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: var(--transition);
}

.filter-input:hover {
    border-color: var(--primary-color);
}

.filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.clear-btn {
    width: 100%;
    padding: 0.65rem;
    background: var(--gray-200);
    color: var(--gray-700);
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.clear-btn:hover {
    background: var(--gray-300);
}

/* ============================================================================
   Results Section
   ============================================================================ */

.results-section {
    min-height: 300px;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    color: var(--gray-500);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state {
    background: white;
    padding: 3rem;
    border-radius: var(--border-radius);
    text-align: center;
    color: var(--gray-600);
    border: 2px dashed var(--gray-300);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   Result Cards
   ============================================================================ */

.accommodation-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    overflow: hidden;
}

.accommodation-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.card-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--gray-100);
    color: var(--gray-700);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge.category-academic { background: #dbeafe; color: #1e40af; }
.badge.category-behavioral { background: #dcfce7; color: #166534; }
.badge.category-environmental { background: #fef3c7; color: #92400e; }
.badge.category-assessment { background: #f3e8ff; color: #6b21a8; }
.badge.category-communication { background: #fce7f3; color: #be185d; }
.badge.category-physical { background: #fee2e2; color: #991b1b; }
.badge.category-social_emotional { background: #cffafe; color: #0c4a6e; }

.card-description {
    font-size: 0.9rem;
    color: var(--gray-600);
    line-height: 1.5;
}

.card-body {
    padding: 1.25rem;
    flex: 1;
}

.card-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    margin-top: 1rem;
}

.stars {
    color: #fbbf24;
}

.rating-count {
    color: var(--gray-500);
    font-size: 0.85rem;
}

.difficulty-indicator {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.difficulty-easy { background: #dcfce7; color: #166534; }
.difficulty-moderate { background: #fef3c7; color: #92400e; }
.difficulty-complex { background: #fee2e2; color: #991b1b; }

.card-footer {
    padding: 1rem 1.25rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 0.5rem;
}

.card-btn {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--gray-300);
    background: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition);
}

.card-btn:hover {
    background: var(--gray-100);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.card-btn.primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.card-btn.primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* ============================================================================
   Pagination
   ============================================================================ */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-top: 2rem;
    padding: 1rem;
    background: white;
    border-radius: var(--border-radius);
}

.pagination-btn {
    padding: 0.75rem 1.25rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary-dark);
}

.pagination-btn:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
    opacity: 0.6;
}

#pageInfo {
    color: var(--gray-600);
    font-weight: 500;
}

/* ============================================================================
   Modals
   ============================================================================ */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

.modal-content.modal-lg {
    max-width: 700px;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
    z-index: 1;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.detail-modal-content {
    padding: 2rem 1.5rem;
}

.detail-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-right: 2rem;
}

.detail-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.detail-section:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    color: var(--gray-700);
    line-height: 1.6;
}

.tags-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.small-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background: var(--gray-100);
    color: var(--gray-700);
    border-radius: 999px;
    font-size: 0.8rem;
}

/* ============================================================================
   Kanban Board (Tracker)
   ============================================================================ */

.tracker-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    gap: 1rem;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.student-filter {
    padding: 0.65rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    background: white;
    cursor: pointer;
    font-weight: 500;
}

.action-btn {
    padding: 0.65rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.action-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.action-btn.export-btn {
    background: var(--success-color);
}

.action-btn.export-btn:hover {
    background: #059669;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}

@media (max-width: 1024px) {
    .kanban-board {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .kanban-board {
        grid-template-columns: 1fr;
    }
}

.kanban-column {
    background: var(--gray-100);
    border-radius: var(--border-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 500px;
}

.column-header {
    background: white;
    padding: 1rem;
    border-bottom: 2px solid var(--primary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.column-header h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
}

.column-count {
    background: var(--primary-color);
    color: white;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.9rem;
}

.kanban-cards {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.kanban-card {
    background: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    cursor: grab;
    transition: var(--transition);
    border-left: 4px solid var(--primary-color);
}

.kanban-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.kanban-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.kanban-card-title {
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--gray-900);
}

.kanban-card-category {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    background: var(--gray-100);
    color: var(--gray-700);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.kanban-card-notes {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.kanban-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--gray-500);
}

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

.kanban-card-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

.kanban-card-btn:hover {
    color: var(--primary-dark);
}

/* ============================================================================
   Forms
   ============================================================================ */

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

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* ============================================================================
   Toast Notifications & Optimistic Updates
   ============================================================================ */

.error-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--danger-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    font-weight: 500;
    max-width: 400px;
    word-wrap: break-word;
}

.success-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--success-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    font-weight: 500;
    max-width: 400px;
    word-wrap: break-word;
}

/* Optimistic update animations */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Pulse effect for loading state */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.kanban-card.optimistic-update {
    animation: pulse 0.6s ease-in-out;
}

/* History Button Styling */
.history-btn {
    transition: all 0.2s ease !important;
}

.history-btn:hover {
    background-color: #dbeafe !important;
    color: #1e40af !important;
    transform: scale(1.05);
}

.history-btn:active {
    transform: scale(0.98);
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.35rem;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .search-input,
    .search-btn {
        width: 100%;
    }
    
    .nav-tabs {
        flex-direction: column;
    }
    
    .tracker-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toolbar-left,
    .toolbar-right {
        flex-direction: column;
    }
    
    .student-filter,
    .action-btn {
        width: 100%;
    }
}

/* ============================================================================
   Accessibility
   ============================================================================ */

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

/* Focus visible for keyboard navigation */
button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: more) {
    .badge,
    .difficulty-indicator {
        border: 1px solid currentColor;
    }
}

