/**
 * University Search & Management - Complete Stylesheet
 * WCAG 2.1 AA Compliant | W3C Valid CSS | Mobile-First Responsive Design
 * Built with accessibility, usability, and modern design principles
 */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #2c3e50;
    background-color: #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Accessibility Features */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #2c3e50;
    color: white;
    padding: 0.75rem 1rem;
    text-decoration: none;
    z-index: 1000;
    border-radius: 0 0 4px 4px;
    font-weight: 600;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 6px;
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus management for better accessibility */
*:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Header and Navigation */
header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
}

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

.site-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.025em;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin: 0;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
    display: block;
}

.nav-link:hover,
.nav-link:focus {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.nav-link[aria-current="page"] {
    background-color: #3498db;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.logout-link {
    background-color: rgba(231, 76, 60, 0.2);
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.logout-link:hover,
.logout-link:focus {
    background-color: #e74c3c;
}

/* Main Content Layout */
main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
}

/* Section Styling */
section {
    margin-bottom: 3rem;
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
}

section h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

section h3 {
    color: #2c3e50;
    margin-bottom: 1.25rem;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
}

section h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.section-description {
    margin-bottom: 2rem;
    color: #5a6c7d;
    font-size: 1.1rem;
    line-height: 1.7;
}

/* Enhanced Typography */
p {
    margin-bottom: 1rem;
    color: #5a6c7d;
    line-height: 1.7;
}

/* Required field indicator */
.required-indicator {
    color: #e74c3c;
    font-weight: 600;
    margin-left: 0.25rem;
}

/* Form Styling */
.form-group {
    margin-bottom: 2rem;
    position: relative;
}

.form-label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: #2c3e50;
    font-size: 1rem;
    line-height: 1.4;
}

.form-input {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background-color: #ffffff;
    color: #2c3e50;
    line-height: 1.5;
}

.form-input:hover {
    border-color: #bdc3c7;
}

.form-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
    background-color: #ffffff;
}

.form-input:invalid:not(:placeholder-shown) {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.15);
}

.form-input::placeholder {
    color: #95a5a6;
    opacity: 1;
}

.help-text {
    font-size: 0.875rem;
    color: #7f8c8d;
    margin-top: 0.5rem;
    line-height: 1.4;
}

.error-text {
    font-size: 0.875rem;
    color: #e74c3c;
    margin-top: 0.5rem;
    font-weight: 500;
    display: none;
}

.error-text:not(:empty) {
    display: block;
}

/* Button Styling */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    line-height: 1;
    min-height: 48px;
    position: relative;
    overflow: hidden;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-primary:hover:not(:disabled),
.btn-primary:focus:not(:disabled) {
    background: linear-gradient(135deg, #2980b9 0%, #1f5f8b 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.btn-danger:hover:not(:disabled),
.btn-danger:focus:not(:disabled) {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(149, 165, 166, 0.3);
}

.btn-secondary:hover:not(:disabled),
.btn-secondary:focus:not(:disabled) {
    background: linear-gradient(135deg, #7f8c8d 0%, #6c7b7d 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(149, 165, 166, 0.4);
}

.search-btn,
.auth-btn {
    min-width: 180px;
    font-size: 1.1rem;
    padding: 1.25rem 2.5rem;
}

/* Authentication Forms */
.auth-header {
    text-align: center;
    margin-bottom: 3rem;
}

.auth-forms {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
    max-width: 800px;
    margin: 0 auto;
}

.form-container {
    padding: 2.5rem;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.form-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3498db, #2980b9);
}

.form-title {
    margin-bottom: 1.5rem;
    color: #2c3e50;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
}

.login-container::before {
    background: linear-gradient(90deg, #27ae60, #2ecc71);
}

.register-container::before {
    background: linear-gradient(90deg, #3498db, #2980b9);
}

/* Search Results */
.search-results {
    margin-top: 2.5rem;
}

.search-results h4 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
    font-size: 1.25rem;
    font-weight: 600;
}

.universities-list {
    display: grid;
    gap: 1.5rem;
}

.university-item {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.university-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #3498db;
}

.university-info {
    flex: 1;
    min-width: 250px;
}

.university-info h5 {
    margin: 0 0 0.75rem 0;
    color: #2c3e50;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
}

.university-info p {
    margin: 0.5rem 0;
    color: #5a6c7d;
    font-size: 0.95rem;
    line-height: 1.4;
}

.university-info a {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.university-info a:hover,
.university-info a:focus {
    color: #2980b9;
    text-decoration: underline;
}

.university-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

/* Table Styling */
.table-container {
    overflow-x: auto;
    margin-top: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.universities-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.table-caption {
    padding: 1rem;
    font-weight: 600;
    color: #2c3e50;
    background: #f8f9fa;
    text-align: left;
    border-bottom: 2px solid #e1e8ed;
}

.universities-table th,
.universities-table td {
    padding: 1.25rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e1e8ed;
    vertical-align: middle;
}

.universities-table th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.university-row {
    transition: all 0.3s ease;
}

.university-row:hover {
    background-color: #f8f9fa;
    transform: scale(1.01);
}

.university-name {
    font-weight: 600;
    color: #2c3e50;
}

.university-country {
    color: #5a6c7d;
}

.website-link {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.3s ease;
}

.website-link:hover,
.website-link:focus {
    color: #2980b9;
    text-decoration: underline;
}

.external-link-icon {
    font-size: 0.8rem;
    opacity: 0.7;
}

.university-actions {
    text-align: center;
}

/* Message Styling */
.message {
    padding: 1.25rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.message-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.message.success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border-left: 4px solid #28a745;
}

.message.error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.message.info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

/* Empty State Styling */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #7f8c8d;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 2px dashed #dee2e6;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.empty-state-title {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.empty-state-description {
    color: #5a6c7d;
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 500px;
    margin: 0 auto;
}

.university-count {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, #e8f5e8 0%, #d4edda 100%);
    border-radius: 8px;
    border-left: 4px solid #28a745;
}

.university-count p {
    margin: 0;
    color: #2c3e50;
}

/* Dashboard Specific Styles */
.dashboard-header {
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
}

.dashboard-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.dashboard-welcome {
    position: relative;
    z-index: 1;
}

.dashboard-header h2 {
    color: white;
    margin-bottom: 1rem;
    font-size: 2.5rem;
    font-weight: 700;
}

.dashboard-description {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2rem;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

/* Welcome Section for Logged-in Users */
.welcome-section {
    text-align: center;
    background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.welcome-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="welcome-pattern" width="50" height="50" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="2" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23welcome-pattern)"/></svg>');
}

.welcome-content {
    position: relative;
    z-index: 1;
}

.welcome-section h2 {
    color: white;
    margin-bottom: 1rem;
    font-size: 2.25rem;
    font-weight: 700;
}

.welcome-description {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.welcome-actions {
    margin-top: 2rem;
}

/* Footer Styling */
footer {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    margin-top: auto;
    padding: 3rem 0 1.5rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section {
    text-align: center;
}

.footer-title {
    color: white;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.footer-subtitle {
    color: white;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.footer-description {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.footer-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-list li {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.footer-bottom p {
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    font-size: 0.9rem;
}

/* Loading States */
.loading-state {
    text-align: center;
    padding: 2rem;
    color: #7f8c8d;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid #e1e8ed;
    border-radius: 50%;
    border-top-color: #3498db;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design - Mobile First Approach */

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
    .nav-menu {
        gap: 1rem;
    }
    
    .form-container {
        padding: 2rem;
    }
    
    .university-item {
        padding: 1.25rem;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .auth-forms {
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
    }
    
    .footer-content {
        grid-template-columns: 2fr 1fr 1fr;
        gap: 3rem;
        text-align: left;
    }
    
    .footer-section:first-child {
        text-align: left;
    }
    
    .universities-table {
        font-size: 0.95rem;
    }
    
    .dashboard-header h2 {
        font-size: 3rem;
    }
    
    .welcome-section h2 {
        font-size: 2.5rem;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .nav-container {
        flex-wrap: nowrap;
    }
    
    .site-title {
        font-size: 2rem;
    }
    
    section {
        padding: 3rem;
    }
    
    .university-item {
        align-items: center;
    }
    
    .university-info {
        min-width: 300px;
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .universities-list {
        grid-template-columns: 1fr 1fr;
    }
    
    .dashboard-header h2 {
        font-size: 3.5rem;
    }
}

/* Mobile-specific styles */
@media (max-width: 767px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
        padding: 0 1rem;
    }
    
    .nav-menu {
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }
    
    .nav-link {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    main {
        padding: 1rem;
    }
    
    section {
        padding: 1.5rem;
        margin-bottom: 2rem;
    }
    
    section h2 {
        font-size: 1.75rem;
    }
    
    .dashboard-header h2 {
        font-size: 2rem;
    }
    
    .welcome-section h2 {
        font-size: 1.75rem;
    }
    
    .university-item {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .university-actions {
        justify-content: center;
    }
    
    .universities-table {
        font-size: 0.875rem;
    }
    
    .universities-table th,
    .universities-table td {
        padding: 0.75rem 0.5rem;
    }
    
    .btn {
        padding: 0.875rem 1.5rem;
        font-size: 0.95rem;
    }
    
    .search-btn,
    .auth-btn {
        min-width: auto;
        width: 100%;
        padding: 1rem 2rem;
    }
}

/* Very small devices */
@media (max-width: 480px) {
    .site-title {
        font-size: 1.25rem;
        text-align: center;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .universities-table {
        min-width: 600px;
    }
    
    .form-container {
        padding: 1.5rem;
    }
    
    .dashboard-header h2 {
        font-size: 1.5rem;
    }
    
    .welcome-section h2 {
        font-size: 1.5rem;
    }
}

/* Accessibility Enhancements */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn-primary {
        border: 2px solid #000;
        background: #000;
    }
    
    .btn-danger {
        border: 2px solid #000;
    }
    
    .form-input:focus {
        border-color: #000;
        box-shadow: 0 0 0 3px #000;
    }
    
    .nav-link:focus {
        outline: 3px solid #000;
        outline-offset: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    html {
        scroll-behavior: auto;
    }
    
    .university-item:hover {
        transform: none;
    }
    
    .btn:hover,
    .btn:focus {
        transform: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --text-color: #e1e1e1;
        --card-bg: #2d2d2d;
    }
    
    /* Note: Full dark mode implementation would require more extensive changes */
}

/* Print styles */
@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    header,
    footer,
    .btn,
    .search-form,
    .nav-menu,
    .university-actions {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
        font-size: 12pt;
        line-height: 1.4;
    }
    
    section {
        box-shadow: none;
        border: 1px solid #000;
        page-break-inside: avoid;
        margin-bottom: 1rem;
    }
    
    h2, h3 {
        page-break-after: avoid;
    }
    
    .universities-table {
        border-collapse: collapse;
        width: 100%;
    }
    
    .universities-table th,
    .universities-table td {
        border: 1px solid #000;
        padding: 0.5rem;
    }
    
    .website-link::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}

/* Focus visible polyfill support */
.js-focus-visible :focus:not(.focus-visible) {
    outline: none;
}

/* 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;
}
/* Additio
nal styles for JavaScript functionality */

/* Search Results Grid */
.search-results-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e1e8ed;
}

.search-results-header h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.search-results-header p {
    color: #5a6c7d;
    margin: 0;
    font-size: 1rem;
}

.universities-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.university-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.university-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #3498db;
}

.university-info {
    flex: 1;
    min-width: 250px;
}

.university-info .university-name {
    margin: 0 0 0.75rem 0;
    color: #2c3e50;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
}

.university-info .university-country {
    margin: 0.5rem 0;
    color: #5a6c7d;
    font-size: 0.95rem;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.university-info .university-website {
    margin: 0.5rem 0;
    color: #5a6c7d;
    font-size: 0.95rem;
    line-height: 1.4;
}

.country-icon {
    font-size: 1rem;
}

.university-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.add-university-btn {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
    transition: all 0.3s ease;
}

.add-university-btn:hover:not(:disabled),
.add-university-btn:focus:not(:disabled) {
    background: linear-gradient(135deg, #229954 0%, #27ae60 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

.add-university-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-success {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.btn-success:hover:not(:disabled),
.btn-success:focus:not(:disabled) {
    background: linear-gradient(135deg, #229954 0%, #27ae60 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

/* Loading States */
.loading-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #7f8c8d;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 2px dashed #dee2e6;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e1e8ed;
    border-radius: 50%;
    border-top-color: #3498db;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.loading-state p {
    margin: 0;
    font-size: 1.1rem;
    color: #5a6c7d;
}

/* No Results State */
.no-results {
    text-align: center;
    padding: 3rem 2rem;
    color: #7f8c8d;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 2px dashed #dee2e6;
}

.no-results-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.no-results h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.no-results p {
    color: #5a6c7d;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.search-tips {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e1e8ed;
    text-align: left;
    max-width: 400px;
    margin: 0 auto;
}

.search-tips h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.search-tips ul {
    margin: 0;
    padding-left: 1.5rem;
    color: #5a6c7d;
}

.search-tips li {
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

/* Search Error State */
.search-error {
    text-align: center;
    padding: 3rem 2rem;
    color: #7f8c8d;
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border-radius: 12px;
    border: 2px solid #e74c3c;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.search-error h3 {
    color: #721c24;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.search-error p {
    color: #721c24;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.retry-search-btn {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.retry-search-btn:hover:not(:disabled),
.retry-search-btn:focus:not(:disabled) {
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

/* Status Message Improvements */
#status-message {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
    animation: slideInRight 0.3s ease;
}

#status-message.message {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: none;
    border-radius: 8px;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Empty State for Table */
.empty-state-cell {
    padding: 3rem 2rem !important;
    text-align: center;
    border: none !important;
}

.empty-state-cell .empty-state {
    background: none;
    border: none;
    padding: 0;
}

/* Button Loading State */
.btn.loading {
    position: relative;
    color: transparent !important;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

/* Form Validation States */
.form-input[aria-invalid="true"] {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.15);
}

.form-input[aria-invalid="true"]:focus {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.25);
}

/* Responsive adjustments for new elements */
@media (min-width: 768px) {
    .universities-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    #status-message {
        top: 30px;
        right: 30px;
    }
}

@media (min-width: 1200px) {
    .universities-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 767px) {
    .university-card {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .university-actions {
        justify-content: center;
    }
    
    .add-university-btn {
        width: 100%;
    }
    
    #status-message {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .search-tips {
        max-width: none;
    }
}

/* Accessibility improvements for dynamic content */
[aria-live] {
    position: relative;
}

/* Focus management for dynamically added content */
.university-card:focus-within {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* High contrast mode adjustments for new elements */
@media (prefers-contrast: high) {
    .university-card {
        border: 2px solid #000;
    }
    
    .add-university-btn,
    .btn-success {
        border: 2px solid #000;
    }
    
    .loading-spinner {
        border-color: #000;
        border-top-color: transparent;
    }
}

/* Reduced motion adjustments for new animations */
@media (prefers-reduced-motion: reduce) {
    .university-card:hover {
        transform: none;
    }
    
    .add-university-btn:hover,
    .add-university-btn:focus {
        transform: none;
    }
    
    #status-message {
        animation: none;
    }
    
    .loading-spinner {
        animation: none;
    }
    
    .btn.loading::after {
        animation: none;
        border: 2px solid rgba(255, 255, 255, 0.5);
        border-radius: 50%;
    }
}