/* 
 * Minimal CSS styling for the Uptime Monitor web app.
 * Kept simple and functional for easy maintenance.
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation */
.navbar {
    background-color: #2c3e50;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-brand a {
    color: #fff;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: bold;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    color: #ecf0f1;
    text-decoration: none;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: #3498db;
}

/* Main container */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
}

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

/* Flash messages */
.flash-messages {
    margin-bottom: 1rem;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.flash-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.flash-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background-color: #3498db;
    color: #fff;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-danger {
    background-color: #e74c3c;
    color: #fff;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-check {
    background-color: #27ae60;
    color: #fff;
}

.btn-check:hover {
    background-color: #219a52;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
}

.status-up {
    background-color: #27ae60;
    color: #fff;
}

.status-down {
    background-color: #e74c3c;
    color: #fff;
}

.status-unknown {
    background-color: #95a5a6;
    color: #fff;
}

/* Hero section */
.hero {
    text-align: center;
    padding: 3rem 0;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.hero p {
    font-size: 1.25rem;
    color: #666;
    margin-bottom: 2rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Features section */
.features {
    background-color: #fff;
    padding: 2rem;
    border-radius: 8px;
    margin-top: 2rem;
}

.features h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.features ul {
    list-style: none;
}

.features li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.features li:last-child {
    border-bottom: none;
}

/* Forms */
.form-container {
    max-width: 400px;
    margin: 0 auto;
    background-color: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.form-container h1 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
}

.form-group small {
    color: #666;
    font-size: 0.875rem;
}

.form-footer {
    margin-top: 1rem;
    text-align: center;
    color: #666;
}

.form-footer a {
    color: #3498db;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Dashboard and lists */
.dashboard h1,
.monitors-list h1 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.dashboard-section {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1.5rem;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
}

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

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

.table a {
    color: #3498db;
}

.table .actions {
    white-space: nowrap;
}

.table .actions form {
    display: inline;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.empty-state a {
    color: #3498db;
    cursor: pointer;
}

/* Dashboard actions */
.dashboard-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

/* Status page toggle */
.status-page-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border: 1px solid #e1e5eb;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.toggle-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toggle-status {
    font-size: 0.875rem;
    font-weight: 500;
}

.toggle-status.enabled {
    color: #28a745;
}

.toggle-status.disabled {
    color: #6c757d;
}

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

/* Status Overview */
.status-overview {
    max-width: 900px;
    margin: 0 auto;
}

.time-range-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.selector-label {
    color: #6c757d;
    font-weight: 500;
}

.range-btn {
    padding: 0.375rem 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    text-decoration: none;
    color: #495057;
    background: #fff;
    font-size: 0.875rem;
    transition: all 0.15s ease;
    cursor: pointer;
}

.range-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.range-btn.active {
    background: #007bff;
    border-color: #007bff;
    color: #fff;
}

/* Service cards */
.service-card {
    background: #fff;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.service-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.service-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.service-name {
    font-weight: 600;
    color: #2c3e50;
    text-decoration: none;
}

.service-name:hover {
    color: #3498db;
}

.service-url {
    color: #999;
    text-decoration: none;
}

.uptime-percentage {
    color: #28a745;
    font-weight: 500;
    font-size: 0.9rem;
}

.status-indicator {
    font-size: 0.85rem;
    font-weight: 500;
}

.status-indicator.operational {
    color: #28a745;
}

.status-indicator.down {
    color: #dc3545;
}

.status-indicator.unknown {
    color: #6c757d;
}

/* Uptime bars */
.uptime-bars {
    display: flex;
    gap: 2px;
    height: 28px;
    align-items: stretch;
}

.uptime-bar {
    flex: 1;
    border-radius: 2px;
    min-width: 3px;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.uptime-bar:hover {
    transform: scaleY(1.1);
}

.bar-up {
    background-color: #27ae60;
}

.bar-partial {
    background-color: #f39c12;
}

.bar-down {
    background-color: #e74c3c;
}

.bar-unknown {
    background-color: #e9ecef;
}

.uptime-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.25rem;
}

/* Legend */
.legend {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #666;
}

.legend-bar {
    width: 16px;
    height: 16px;
    border-radius: 2px;
}

/* Leaderboard */
.leaderboard-page h1 {
    margin-bottom: 0.5rem;
}

.leaderboard-subtitle {
    color: #666;
    margin-bottom: 1.5rem;
}

.leaderboard-info {
    background: #e8f4fd;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.leaderboard-info p {
    margin: 0.25rem 0;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.leaderboard-table th {
    background: #2c3e50;
    color: #fff;
    font-weight: 600;
}

.leaderboard-table tbody tr:hover {
    background: #f8f9fa;
}

.rank-cell {
    font-size: 1.25rem;
    text-align: center;
    width: 60px;
}

.score-cell {
    font-weight: 600;
    color: #3498db;
}

.rank-gold {
    background: linear-gradient(90deg, #fff9e6 0%, #fff 50%);
}

.rank-silver {
    background: linear-gradient(90deg, #f5f5f5 0%, #fff 50%);
}

.rank-bronze {
    background: linear-gradient(90deg, #fdf4ed 0%, #fff 50%);
}

/* Settings page */
.settings-page h1 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
}

.settings-section {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.settings-section h2 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.section-description {
    color: #666;
    margin-bottom: 1.5rem;
}

.setting-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.setting-card h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: #2c3e50;
}

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

.setting-description {
    color: #666;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.url-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #fff;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    margin-bottom: 0.5rem;
}

.url-display code {
    font-family: monospace;
    word-break: break-all;
}

.input-with-prefix {
    display: flex;
    align-items: center;
}

.input-prefix {
    background: #e9ecef;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-right: none;
    border-radius: 4px 0 0 4px;
    color: #666;
    font-size: 0.9rem;
    white-space: nowrap;
}

.input-with-prefix input {
    border-radius: 0 4px 4px 0;
}

.text-success {
    color: #28a745;
}

.text-muted {
    color: #6c757d;
}

.text-danger {
    color: #dc3545;
}

/* Monitor details */
.monitor-details {
    max-width: 900px;
    margin: 0 auto;
}

.title-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.monitor-url {
    margin-top: 0.5rem;
}

.monitor-url a {
    color: #666;
    text-decoration: none;
}

.monitor-url a:hover {
    color: #3498db;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.stat-card {
    background: #fff;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
}

.history-section {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.history-section h2 {
    margin: 0;
}

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

.uptime-bars-large {
    display: flex;
    gap: 2px;
    height: 40px;
    align-items: stretch;
}

.last-check-section {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.last-check-section h2 {
    margin-bottom: 1rem;
}

.actions-section {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Status badges large */
.status-up-lg {
    background-color: #d4edda;
    color: #155724;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-down-lg {
    background-color: #f8d7da;
    color: #721c24;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-unknown-lg {
    background-color: #e9ecef;
    color: #6c757d;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Footer */
.footer {
    background-color: #2c3e50;
    color: #ecf0f1;
    text-align: center;
    padding: 1rem;
    margin-top: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
}
