/* Modern & Professional Design System for Uptime Tracker */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700;800&display=swap');

:root {
    --bg-gradient: radial-gradient(at 50% 0%, rgba(99, 102, 241, 0.05) 0px, transparent 50%), 
                    radial-gradient(at 0% 0%, rgba(243, 244, 246, 0.3) 0px, transparent 50%), 
                    #f8fafc;
    --bg-color: #f8fafc;
    --text-color: #0f172a; /* Slate 900 */
    --text-secondary: #64748b; /* Slate 500 */
    --primary-color: #4f46e5; /* Indigo 600 */
    --primary-hover: #4338ca; /* Indigo 700 */
    --primary-light: #e0e7ff; /* Indigo 100 */
    --sidebar-bg: #0f172a; /* Slate 900 */
    --sidebar-active: rgba(255, 255, 255, 0.08);
    --card-bg: #ffffff;
    --card-border: 1px solid #f1f5f9;
    --border-radius-lg: 16px;
    --border-radius-md: 12px;
    --border-radius-sm: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    
    --success-color: #10b981; /* Emerald 500 */
    --success-bg: #ecfdf5; /* Emerald 500 5% */
    --danger-color: #f43f5e; /* Rose 500 */
    --danger-bg: #fff1f2;
    --warning-color: #f59e0b; /* Amber 500 */
    --warning-bg: #fef3c7;
    --info-color: #0ea5e9; /* Sky 500 */
    --info-bg: #e0f2fe;

    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    background-image: var(--bg-gradient);
    color: var(--text-color);
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    color: #f1f5f9;
    display: flex;
    flex-direction: column;
    padding: 40px 24px;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar .app-brand {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 48px;
    padding-left: 8px;
    letter-spacing: -0.02em;
}

.sidebar .nav-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar .nav-links a {
    color: #94a3b8;
    text-decoration: none;
    font-weight: 500;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
}

.sidebar .nav-links a svg {
    color: #64748b;
    transition: all 0.2s ease;
}

.sidebar .nav-links a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.04);
}

.sidebar .nav-links a:hover svg {
    color: #94a3b8;
}

.sidebar .nav-links a.active {
    color: #ffffff;
    background: var(--primary-color);
    box-shadow: 0 4px 14px 0 rgba(79, 70, 229, 0.35);
}

.sidebar .nav-links a.active svg {
    color: #ffffff;
}

.sidebar .logout-btn-wrapper {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar .logout-btn-wrapper button {
    width: 100%;
    text-align: left;
    background: rgba(255, 255, 255, 0.05);
    color: #f1f5f9;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.sidebar .logout-btn-wrapper button:hover {
    background: rgba(244, 63, 94, 0.1);
    color: #f43f5e;
    border-color: rgba(244, 63, 94, 0.2);
}

.main-wrapper {
    flex: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-wrapper-full {
    margin-left: 0;
}

/* Header */
.top-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 24px 40px;
    background: transparent;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px;
    width: 100%;
    flex: 1;
}

/* Card Utility */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm), var(--shadow-md);
    border: var(--card-border);
}

/* Colored Stat Cards */
.stat-card {
    background: var(--card-bg);
    border: var(--card-border);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-sm);
}

.stat-card .icon-wrapper {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-total .icon-wrapper { background: var(--info-bg); color: var(--info-color); }
.stat-card-active .icon-wrapper { background: var(--warning-bg); color: var(--warning-color); }
.stat-card-up .icon-wrapper { background: var(--success-bg); color: var(--success-color); }
.stat-card-down .icon-wrapper { background: var(--danger-bg); color: var(--danger-color); }

.stat-card .stat-details {
    display: flex;
    flex-direction: column;
}

.stat-card .stat-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-card .stat-value {
    font-family: var(--font-heading);
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-family);
    font-size: 0.925rem;
}

.btn-primary {
    background: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 4px 12px 0 rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px 0 rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    background: #ffffff;
    color: var(--text-color);
    border-color: #cbd5e1;
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger-color);
    border-color: rgba(244, 63, 94, 0.1);
}

.btn-danger:hover {
    background: #ffe4e6;
    transform: translateY(-1px);
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 11px 16px;
    border-radius: var(--border-radius-md);
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: var(--text-color);
    font-size: 0.95rem;
    font-family: var(--font-family);
    transition: all 0.2s ease;
}

.form-control::placeholder {
    color: #94a3b8;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Auth Pages Centered Layout */
.auth-body {
    background-image: var(--bg-gradient);
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    margin: 40px auto;
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--border-radius-md);
    margin-bottom: 16px;
    box-shadow: 0 8px 16px rgba(79, 70, 229, 0.3);
}

.auth-title {
    font-family: var(--font-heading);
    font-size: 1.875rem;
    font-weight: 800;
    color: var(--text-color);
    letter-spacing: -0.025em;
}

.auth-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* Alert Boxes */
.alert {
    padding: 14px 16px;
    border-radius: var(--border-radius-md);
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger-color);
    border: 1px solid rgba(244, 63, 94, 0.15);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    line-height: 1;
}

.badge-up {
    background: var(--success-bg);
    color: var(--success-color);
}

.badge-down {
    background: var(--danger-bg);
    color: var(--danger-color);
}

.badge-paused {
    background: #f1f5f9;
    color: #64748b;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.modern-table th {
    padding: 16px 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid #cbd5e1;
}

.modern-table td {
    padding: 18px 20px;
    border-bottom: 1px solid #e2e8f0;
    color: var(--text-color);
    font-size: 0.925rem;
    vertical-align: middle;
}

.modern-table tbody tr {
    transition: background 0.15s ease;
}

.modern-table tbody tr:hover {
    background: #f8fafc;
}

/* Response Time Sparkline / Bar Chart */
.chart-container {
    margin-top: 16px;
    background: #ffffff;
    border: var(--card-border);
    border-radius: var(--border-radius-lg);
    padding: 24px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 140px;
    padding-top: 10px;
    position: relative;
    border-bottom: 2px solid #cbd5e1;
}

.bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: pointer;
    height: 100%;
    justify-content: flex-end;
}

.bar-column {
    width: 100%;
    background: #c7d2fe; /* Indigo 200 light state */
    border-radius: 4px 4px 0 0;
    transition: all 0.2s ease;
}

.bar-wrapper:hover .bar-column {
    background: var(--primary-color) !important;
}

.bar-column.status-down {
    background: #fca5a5 !important; /* Rose 300 */
}

.bar-wrapper:hover .bar-column.status-down {
    background: var(--danger-color) !important;
}

/* Tooltips */
.bar-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    background: var(--sidebar-bg);
    color: #ffffff;
    font-size: 0.75rem;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    z-index: 100;
}

.bar-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 4px;
    border-style: solid;
    border-color: var(--sidebar-bg) transparent transparent transparent;
}

.bar-wrapper:hover .bar-tooltip {
    opacity: 1;
    transform: translateY(0);
}

/* Grid helper */
.grid-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 32px;
}

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

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mt-6 { margin-top: 24px; }
.mb-6 { margin-bottom: 24px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-4 { gap: 16px; }
.fw-semibold { font-weight: 600; }
.fw-bold { font-weight: 700; }

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 20px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    
    .sidebar .app-brand {
        margin-bottom: 20px;
    }
    
    .sidebar .nav-links {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .main-wrapper {
        margin-left: 0;
    }
    
    .container {
        padding: 20px;
    }
}
