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

/* CSS Custom Properties for theming */
:root {
    /* Light theme colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --accent-primary: #3b82f6;
    --accent-secondary: #1d4ed8;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Status colors */
    --status-online: #10b981;
    --status-offline: #ef4444;
    --status-warning: #f59e0b;
    
    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 300ms ease-in-out;
}

/* Dark theme */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --accent-primary: #60a5fa;
    --accent-secondary: #3b82f6;
    --border-color: #374151;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
}

/* Base typography and layout */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color var(--transition-normal), color var(--transition-normal);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Screen reader only text */
.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;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    gap: 1rem;
}

.logo {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    transition: color var(--transition-normal);
}

.logo-subtitle {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color var(--transition-normal);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Search */
.search-container {
    position: relative;
}

.search-input {
    width: 100%;
    min-width: 200px;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
}

.search-input::placeholder {
    color: var(--text-muted);
}

/* Header buttons (support and theme toggle) */
.support-btn,
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.support-btn:hover,
.theme-toggle:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--accent-primary);
}

.support-btn:focus,
.theme-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
}

/* Main content */
.main {
    flex: 1;
    padding: 2rem 0;
}

/* Filters */
.filters-section {
    margin-bottom: 2rem;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 2rem;
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.filter-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
}

.filter-btn.active {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* Services grid */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* Service cards */
.service-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    text-decoration: none;
    color: inherit;
    display: block;
    position: relative;
    overflow: hidden;
}

.service-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
}

.service-card:focus {
    outline: none;
    box-shadow: var(--shadow-lg), 0 0 0 3px rgb(59 130 246 / 0.1);
    transform: translateY(-4px);
}

.service-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.service-info {
    flex: 1;
}

.service-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.service-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.service-status {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-indicator {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-online .status-indicator {
    background-color: var(--status-online);
}

.status-offline .status-indicator {
    background-color: var(--status-offline);
}

.status-warning .status-indicator {
    background-color: var(--status-warning);
}

.status-online {
    color: var(--status-online);
}

.status-offline {
    color: var(--status-offline);
}

.status-warning {
    color: var(--status-warning);
}

.service-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 1rem;
}

.service-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    background-color: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 0.25rem;
    text-transform: lowercase;
}

/* Loading and empty states */
.loading,
.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
}

.loading-spinner {
    width: 2rem;
    height: 2rem;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

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

.no-results h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.no-results p {
    color: var(--text-secondary);
}

/* Footer */
.footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.footer-content {
    padding: 1.5rem 0;
    text-align: center;
}

.footer-content p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.footer-link {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-link:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

.footer-tech {
    font-size: 0.75rem !important;
    color: var(--text-muted) !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 0.75rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        padding: 0.75rem 0;
    }
    
    .header-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-input {
        min-width: 0;
        flex: 1;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
    }
    
    .filters {
        justify-content: center;
    }
    
    .main {
        padding: 1rem 0;
    }
}

@media (max-width: 480px) {
    .service-card {
        padding: 1rem;
    }
    
    .service-header {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .service-status {
        align-self: flex-start;
    }
    
    .filter-btn {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }
}

/* Print styles */
@media print {
    .header-controls,
    .filters-section,
    .footer {
        display: none;
    }
    
    .service-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .service-card:hover {
        transform: none;
    }
}