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

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    overflow: hidden;
    width: 100%;
    overflow-x: hidden;
}

.container {
    display: flex;
    height: 100vh;
    max-width: 1800px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    gap: 20px;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.15);
}

.sidebar-header h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 8px;
}

.app-tagline {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.navigation {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-size: 15px;
    color: #555;
}

.nav-item:hover {
    background: rgba(102, 126, 234, 0.08);
    border-color: rgba(102, 126, 234, 0.2);
}

.nav-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.nav-icon {
    font-size: 20px;
}

.nav-label {
    font-weight: 500;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 2px solid rgba(102, 126, 234, 0.15);
}

.watchlist-section {
    margin-top: 24px;
    margin-bottom: 16px;
}

.watchlist-section h4 {
    font-size: 14px;
    color: #333;
    margin-bottom: 12px;
    font-weight: 600;
}

.watchlist-container {
    max-height: 200px;
    overflow-y: auto;
}

.empty-watchlist {
    font-size: 13px;
    color: #999;
    font-style: italic;
    padding: 12px;
    text-align: center;
}

.watchlist-item {
    padding: 10px 12px;
    background: rgba(102, 126, 234, 0.08);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.watchlist-item:hover {
    background: rgba(102, 126, 234, 0.15);
    transform: translateX(2px);
}

.watchlist-item.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.watchlist-item-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}

.watchlist-item-type {
    font-size: 11px;
    opacity: 0.8;
}

.remove-watchlist {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.3);
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s;
}

.watchlist-item:hover .remove-watchlist {
    opacity: 1;
}

.profile-status {
    margin-top: 16px;
}

.profile-btn {
    width: 100%;
    padding: 12px;
    background: rgba(102, 126, 234, 0.1);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
}

.profile-btn:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.profile-btn.has-profile {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border-color: #667eea;
}

.student-profile-summary h4 {
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
}

.no-profile {
    font-size: 13px;
    color: #999;
    font-style: italic;
}

/* Main Content */
.main-content {
    flex: 1;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.content-section {
    display: none;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}

.content-section.active {
    display: flex;
}

.section-header {
    padding: 32px 40px 24px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.1);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

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

.subtitle {
    font-size: 15px;
    color: #666;
}

/* Search Section */
.search-container {
    padding: 32px 40px;
    flex: 1;
}

.search-type-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    padding: 8px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 12px;
    flex-wrap: wrap;
}

.search-type-selector label {
    flex: 1;
    min-width: 100px;
    cursor: pointer;
}

.search-type-selector input[type="radio"] {
    display: none;
}

.search-type-selector span {
    display: block;
    padding: 10px 16px;
    text-align: center;
    background: white;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
    transition: all 0.2s;
}

.search-type-selector input[type="radio"]:checked + span {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.search-type-selector label:hover span {
    border-color: #667eea;
}

.search-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
}

.search-input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    font-size: 15px;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
}

.miles-control {
    margin-bottom: 24px;
    padding: 16px 20px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 12px;
}

.miles-control label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

#milesValue {
    color: #667eea;
    font-size: 16px;
}

.miles-slider {
    width: 100%;
    height: 6px;
    border-radius: 5px;
    background: rgba(102, 126, 234, 0.2);
    outline: none;
    -webkit-appearance: none;
}

.miles-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.miles-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    border: none;
}

.primary-btn {
    padding: 16px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.secondary-btn {
    padding: 12px 24px;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.welcome-state {
    text-align: center;
    padding: 60px 40px;
    color: #666;
}

.welcome-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.welcome-state h3 {
    font-size: 24px;
    color: #333;
    margin-bottom: 12px;
}

.welcome-state p {
    margin-bottom: 24px;
}

.example-searches {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.example-chip {
    padding: 10px 20px;
    background: rgba(102, 126, 234, 0.1);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 20px;
    color: #667eea;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.example-chip:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
    transform: translateY(-2px);
}

.search-results {
    margin-bottom: 24px;
}

.school-chat {
    border-top: 2px solid rgba(102, 126, 234, 0.1);
    padding-top: 24px;
}

.school-chat h3 {
    font-size: 20px;
    color: #333;
    margin-bottom: 16px;
}

.chat-messages {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 16px;
    padding: 16px;
    background: rgba(102, 126, 234, 0.03);
    border-radius: 12px;
}

.chat-input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input-container textarea {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
}

.chat-input-container textarea:focus {
    outline: none;
    border-color: #667eea;
}

.send-btn {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover {
    transform: translateY(-2px);
}

.hidden {
    display: none !important;
}

/* Application Section */
.application-container {
    padding: 32px 40px;
}

.profile-setup {
    margin-bottom: 32px;
    padding: 24px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 16px;
}

.profile-setup h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 16px;
}

.profile-textarea, .question-textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 16px;
}

.profile-textarea:focus, .question-textarea:focus {
    outline: none;
    border-color: #667eea;
}

.application-workspace {
    padding: 24px;
    border: 2px solid rgba(102, 126, 234, 0.15);
    border-radius: 16px;
}

.application-workspace h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 16px;
}

.school-context {
    margin: 24px 0;
}

.school-context h4 {
    font-size: 16px;
    color: #333;
    margin-bottom: 12px;
}

.school-context-box {
    padding: 16px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 12px;
}

.no-selection {
    color: #999;
    font-style: italic;
    font-size: 14px;
}

.response-area {
    margin-top: 24px;
    padding: 24px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 16px;
}

.response-area h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 16px;
}

.generated-text {
    padding: 20px;
    background: white;
    border-radius: 12px;
    margin-bottom: 16px;
    line-height: 1.8;
    color: #333;
}

.response-actions {
    display: flex;
    gap: 12px;
}

/* Interview Section */
.interview-container {
    padding: 32px 40px;
}

.interview-setup {
    padding: 24px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 16px;
    margin-bottom: 32px;
}

.setup-item h4 {
    font-size: 16px;
    color: #333;
    margin-bottom: 12px;
}

.school-selector {
    padding: 16px;
    background: white;
    border-radius: 12px;
    margin-bottom: 16px;
}

.questions-container {
    margin-bottom: 32px;
}

.questions-container h3 {
    font-size: 20px;
    color: #333;
    margin-bottom: 16px;
}

.questions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.question-item {
    padding: 16px 20px;
    background: rgba(102, 126, 234, 0.08);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.question-item:hover {
    background: rgba(102, 126, 234, 0.15);
    transform: translateX(4px);
}

.recording-area {
    padding: 24px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 16px;
}

.current-question {
    margin-bottom: 32px;
    padding: 24px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 12px;
}

.current-question h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 12px;
}

.question-text {
    font-size: 16px;
    color: #555;
    line-height: 1.6;
}

.recorder {
    text-align: center;
    padding: 40px;
}

.timer {
    font-size: 24px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 24px;
}

.record-btn {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 6px solid rgba(102, 126, 234, 0.2);
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.record-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.record-btn.recording {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.record-icon {
    font-size: 32px;
}

.record-label {
    font-size: 14px;
    font-weight: 600;
}

.recording-hint {
    color: #999;
    font-size: 14px;
}

.transcription-area {
    margin-top: 32px;
    padding: 24px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 16px;
}

.transcription-area h4 {
    font-size: 18px;
    color: #333;
    margin-bottom: 16px;
}

.transcription-text {
    padding: 20px;
    background: white;
    border-radius: 12px;
    margin-bottom: 24px;
    line-height: 1.8;
    color: #333;
}

.feedback-container {
    margin-bottom: 24px;
}

.feedback-container h4 {
    font-size: 18px;
    color: #333;
    margin-bottom: 16px;
}

.feedback-content {
    padding: 20px;
    background: white;
    border-radius: 12px;
    line-height: 1.8;
    color: #333;
}

/* Scrollbar */
.content-section::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.content-section::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
    background: rgba(102, 126, 234, 0.05);
    border-radius: 10px;
}

.content-section::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 10px;
}

.content-section::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    
    .container {
        padding: 10px;
        gap: 10px;
    }
}

@media (max-width: 768px) {
    body {
        overflow: auto;
        height: auto;
        min-height: 100vh;
    }
    
    .container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        padding: 0;
        gap: 0;
    }
    
    /* Sidebar becomes top bar */
    .sidebar {
        width: 100%;
        height: auto;
        border-radius: 0;
        padding: 16px;
        position: sticky;
        top: 0;
        z-index: 100;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar-header {
        margin-bottom: 12px;
        padding-bottom: 12px;
    }
    
    .sidebar-header h2 {
        font-size: 18px;
        margin-bottom: 4px;
    }
    
    .app-tagline {
        font-size: 11px;
    }
    
    /* Navigation as horizontal tabs */
    .navigation {
        display: flex;
        flex-direction: row;
        gap: 6px;
        margin-bottom: 12px;
        overflow-x: visible;
        flex-wrap: nowrap;
    }
    
    .nav-item {
        flex: 1;
        min-width: 0;
        padding: 10px 8px;
        font-size: 12px;
        white-space: nowrap;
    }
    
    .nav-icon {
        font-size: 18px;
        margin-bottom: 2px;
    }
    
    .nav-label {
        font-size: 11px;
    }
    
    /* Watchlist collapsible on mobile */
    .watchlist-section {
        max-height: 150px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .watchlist-section h4 {
        font-size: 13px;
        position: sticky;
        top: 0;
        background: white;
        z-index: 1;
        padding: 8px 0;
    }
    
    .watchlist-item {
        padding: 8px;
        font-size: 12px;
    }
    
    .sidebar-footer {
        margin-top: 12px;
        padding-top: 12px;
    }
    
    .profile-btn {
        font-size: 13px;
        padding: 10px 16px;
    }
    
    /* Main content */
    .main-content {
        width: 100%;
        border-radius: 0;
        overflow-y: auto;
        overflow-x: hidden;
        height: auto;
        min-height: calc(100vh - 300px);
        -webkit-overflow-scrolling: touch;
    }
    
    /* Search section */
    .search-container {
        padding: 16px;
    }
    
    .search-type-selector {
        gap: 4px;
        padding: 6px;
        flex-wrap: wrap;
    }
    
    .search-type-selector label {
        flex: 1 1 calc(50% - 4px);
        min-width: calc(50% - 4px);
    }
    
    .search-type-selector span {
        padding: 8px 6px;
        font-size: 12px;
    }
    
    .search-input-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-input {
        width: 100%;
        font-size: 14px;
        padding: 12px;
    }
    
    .primary-btn {
        width: 100%;
        padding: 12px;
        font-size: 14px;
    }
    
    .miles-control {
        padding: 12px;
    }
    
    .miles-control label {
        font-size: 13px;
    }
    
    /* School cards */
    .school-card {
        padding: 14px;
        margin-bottom: 12px;
        font-size: 14px;
    }
    
    .school-card-title {
        font-size: 16px;
    }
    
    .school-card-type, .school-card-meta {
        font-size: 12px;
    }
    
    .school-card-description {
        font-size: 13px;
    }
    
    .icon-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .niche-badge {
        font-size: 11px;
        padding: 3px 8px;
    }
    
    /* Chat section */
    .chat-container {
        padding: 12px;
    }
    
    .chat-messages {
        max-height: 250px;
    }
    
    .chat-message {
        font-size: 13px;
        padding: 10px 12px;
    }
    
    /* Application & Interview sections */
    .application-container,
    .interview-container {
        padding: 16px;
    }
    
    .section-header h2 {
        font-size: 20px;
    }
    
    .section-description {
        font-size: 13px;
    }
    
    textarea {
        font-size: 14px;
        min-height: 100px;
    }
    
    .recording-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .record-btn {
        width: 100%;
    }
}

/* Mobile Modal Improvements */
@media (max-width: 768px) {
    .modal {
        padding: 0;
        align-items: flex-start;
        position: fixed;
        overflow: hidden;
    }
    
    .modal-content {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
    }
    
    .modal-header {
        padding: 16px;
        flex-shrink: 0;
        background: white;
        z-index: 10;
        border-bottom: 2px solid #f0f0f0;
    }
    
    .modal-header h2 {
        font-size: 18px;
        margin-bottom: 0;
    }
    
    .close-modal {
        font-size: 32px;
        width: 40px;
        height: 40px;
    }
    
    .modal-body {
        flex: 1;
        overflow-y: scroll;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 16px;
        /* Critical: allow proper scrolling on iOS */
        position: relative;
        height: auto;
    }
    
    .modal-footer {
        padding: 12px 16px;
        flex-shrink: 0;
        background: white;
        border-top: 2px solid #f0f0f0;
        z-index: 10;
    }
    
    /* Form improvements for mobile */
    .form-section {
        margin-bottom: 20px;
    }
    
    .form-section h3 {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .form-group {
        margin-bottom: 18px;
        /* Add padding for easier touch on iOS */
        padding: 4px 0;
    }
    
    .form-group label {
        font-size: 14px;
        margin-bottom: 8px;
        display: block;
        font-weight: 600;
    }
    
    .form-group input[type="text"],
    .form-group input[type="number"],
    .form-group select,
    .form-group textarea {
        font-size: 16px !important; /* Prevents iOS zoom */
        padding: 14px 12px;
        width: 100%;
        border: 2px solid #ddd;
        border-radius: 8px;
        -webkit-appearance: none;
        appearance: none;
        background-color: white;
        /* Critical for iOS touch behavior */
        touch-action: manipulation;
        /* Ensure input is properly clickable */
        position: relative;
        z-index: 1;
    }
    
    .form-group input[type="text"]:focus,
    .form-group input[type="number"]:focus,
    .form-group select:focus,
    .form-group textarea:focus {
        outline: none;
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }
    
    .form-group select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        padding-right: 40px;
    }
    
    .form-group textarea {
        min-height: 100px;
        resize: vertical;
        font-family: inherit;
    }
    
    .form-group small {
        font-size: 12px;
        color: #666;
        display: block;
        margin-top: 6px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-row .form-group {
        width: 100%;
        margin-bottom: 18px;
    }
    
    /* Button improvements */
    .modal-footer .primary-btn {
        width: 100%;
        padding: 16px;
        font-size: 16px;
        font-weight: 600;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    .cancel-btn {
        width: 100%;
        padding: 14px;
        font-size: 15px;
        margin-bottom: 10px;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Extra small phones */
@media (max-width: 375px) {
    .sidebar-header h2 {
        font-size: 16px;
    }
    
    .nav-item {
        padding: 8px 6px;
    }
    
    .nav-label {
        font-size: 10px;
    }
    
    .search-type-selector label {
        flex: 1 1 100%;
        min-width: 100%;
    }
    
    .school-card {
        padding: 12px;
    }
    
    .school-card-title {
        font-size: 15px;
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 24px 32px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 24px;
    color: #333;
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-modal:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.modal-body {
    padding: 32px;
    overflow-y: auto;
}

.form-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.1);
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h3 {
    font-size: 18px;
    color: #667eea;
    margin-bottom: 16px;
    font-weight: 600;
}

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

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

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

.form-group small {
    display: block;
    font-size: 12px;
    color: #999;
    margin-top: 4px;
    font-style: italic;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid rgba(102, 126, 234, 0.1);
}

/* School Cards */
.search-results-header {
    margin-bottom: 24px;
}

.search-results-header h3 {
    font-size: 20px;
    color: #333;
    margin-bottom: 8px;
}

.search-results-header p {
    font-size: 14px;
    color: #666;
}

.load-more-container {
    display: flex;
    justify-content: center;
    margin-top: 32px;
    margin-bottom: 24px;
}

.load-more-container .primary-btn {
    padding: 14px 36px;
    font-size: 15px;
    min-width: 200px;
}

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

.school-card {
    background: rgba(102, 126, 234, 0.05);
    border: 2px solid rgba(102, 126, 234, 0.15);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    /* Disable all transitions to prevent flashing */
    transition: none !important;
    will-change: auto;
}

.school-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    /* Remove transform to prevent browser flashing */
}

.school-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.school-card-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.school-card-type {
    font-size: 13px;
    color: #667eea;
    font-weight: 600;
}

.school-card-meta {
    font-size: 13px;
    color: #666;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.school-card-meta a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.2s;
}

.school-card-meta a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.niche-badge {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 12px;
    display: inline-block;
}

.school-card-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    background: rgba(102, 126, 234, 0.1);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: scale(1.1);
}

.icon-btn.added {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.school-card-description {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 12px;
}

.school-card-details {
    display: none;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid rgba(102, 126, 234, 0.15);
}

.school-card-details.expanded {
    display: block;
}

.detail-item {
    margin-bottom: 12px;
}

.detail-label {
    font-weight: 600;
    color: #667eea;
    font-size: 13px;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
}

.expand-btn {
    background: none;
    border: none;
    color: #667eea;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    padding: 8px 0;
    transition: color 0.2s;
}

.expand-btn:hover {
    color: #764ba2;
}

.school-selector-box {
    padding: 24px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 16px;
    margin-bottom: 24px;
}

.school-selector-box h3 {
    font-size: 18px;
    color: #333;
    margin-bottom: 12px;
}

.school-select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    background: white;
    cursor: pointer;
    margin-bottom: 16px;
}

.school-select:focus {
    outline: none;
    border-color: #667eea;
}

.analysis-section {
    margin-bottom: 24px;
    padding: 20px;
    background: rgba(255, 193, 7, 0.1);
    border-left: 4px solid #ffc107;
    border-radius: 12px;
}

.analysis-section h4 {
    font-size: 16px;
    color: #f57c00;
    margin-bottom: 12px;
}

.analysis-content {
    font-size: 14px;
    color: #555;
    line-height: 1.8;
}

.response-section {
    margin-bottom: 24px;
}

.response-section h4 {
    font-size: 16px;
    color: #333;
    margin-bottom: 12px;
}

.chat-message {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 85%;
}

.chat-message.user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: auto;
}

.chat-message.assistant {
    background: rgba(102, 126, 234, 0.1);
    color: #333;
}

.chat-message strong {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    opacity: 0.9;
}

.chat-message p {
    margin: 0;
    line-height: 1.6;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #667eea;
    font-size: 16px;
}

.error {
    text-align: center;
    padding: 40px;
    color: #f44336;
    font-size: 14px;
}
