/* Modern Apple-inspired SaaS Design */

:root {
    --primary-color: #007AFF;
    --primary-hover: #0051D5;
    --success-color: #34C759;
    --warning-color: #FF9500;
    --danger-color: #FF3B30;
    --secondary-color: #8E8E93;
    --background: #F5F5F7;
    --surface: #FFFFFF;
    --text-primary: #1D1D1F;
    --text-secondary: #86868B;
    --border-color: #D2D2D7;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

* {
    box-sizing: border-box;
}

body {
    background: var(--background);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Navigation */
.navbar {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 0.75rem 0;
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--text-primary) !important;
    letter-spacing: -0.02em;
}

.app-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
}

.app-navbar .container-fluid {
    gap: 1rem;
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    min-height: 48px;
    flex: 0 0 auto;
    margin-right: 0;
}

.app-brand:hover {
    color: var(--text-primary) !important;
}

.app-brand-mark {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.14), rgba(52, 199, 89, 0.14));
    color: var(--text-primary);
    font-size: 1rem;
}

.app-brand-copy {
    display: grid;
    line-height: 1.1;
}

.app-brand-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.app-brand-subtitle {
    color: var(--text-secondary);
    font-size: 0.73rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    transition: color 0.2s ease;
    padding: 0.5rem 0.65rem !important;
    border-radius: var(--radius-sm);
    line-height: 1.15;
    white-space: nowrap;
}

.navbar-collapse {
    min-width: 0;
}

.navbar-nav {
    gap: 0.15rem;
}

.navbar-nav .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.navbar-nav .nav-link i {
    flex: 0 0 auto;
    font-size: 0.95em;
}

.nav-link:hover {
    color: var(--primary-color) !important;
    background: rgba(0, 122, 255, 0.08);
}

.nav-link.active,
.nav-link[aria-current="page"] {
    color: var(--text-primary) !important;
    background: rgba(29, 29, 31, 0.05);
}

.navbar-nav .dropdown-menu {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin-top: 0.5rem;
    min-width: 14rem;
    padding: 0.45rem;
}

.navbar-nav .dropdown-item {
    align-items: center;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    display: flex;
    font-weight: 500;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
}

.navbar-nav .dropdown-item i {
    flex: 0 0 auto;
    font-size: 0.95em;
}

.navbar-nav .dropdown-item:hover,
.navbar-nav .dropdown-item:focus {
    background: rgba(0, 122, 255, 0.08);
    color: var(--primary-color);
}

.navbar-nav .dropdown-item.active,
.navbar-nav .dropdown-item:active {
    background: rgba(29, 29, 31, 0.05);
    color: var(--text-primary);
}

/* Main Container */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

@media (min-width: 768px) {
    main {
        padding: 3rem 2rem;
    }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

/* Breadcrumbs */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.breadcrumb-item a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-item a:hover {
    color: var(--primary-color);
}

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: 500;
}

/* Cards */
.card {
    background: var(--surface);
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    border-radius: 0;
}

.card-body {
    padding: 1.5rem;
}

.status-trend-chart {
    height: 320px;
    width: 100%;
}

/* Buttons */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    transition: all 0.2s ease;
    border: none;
    letter-spacing: -0.01em;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.btn-outline-secondary {
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--background);
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    letter-spacing: -0.01em;
}

.badge.bg-success {
    background: var(--success-color) !important;
    color: white;
}

.badge.bg-danger {
    background: var(--danger-color) !important;
    color: white;
}

.badge.bg-warning {
    background: var(--warning-color) !important;
    color: white;
}

.badge.bg-secondary {
    background: var(--secondary-color) !important;
    color: white;
}

/* Tables */
.table {
    font-size: 0.9375rem;
    margin-bottom: 0;
}

.table thead th {
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 1rem;
}

.table tbody td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.runs-table thead th,
.runs-table tbody td {
    padding: 0.5rem 0.75rem;
}

.table-hover tbody tr {
    transition: background-color 0.2s ease;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 122, 255, 0.04);
    cursor: pointer;
}

.table-light {
    background: var(--background);
}

/* Alerts */
.alert {
    border-radius: var(--radius-sm);
    border: none;
    padding: 1rem 1.25rem;
    font-weight: 500;
}

.alert-info {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
}

.alert-success {
    background: rgba(52, 199, 89, 0.1);
    color: var(--success-color);
}

.alert-warning {
    background: rgba(255, 149, 0, 0.1);
    color: var(--warning-color);
}

.alert-danger {
    background: rgba(255, 59, 48, 0.1);
    color: var(--danger-color);
}

/* Status Cards */
.status-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.status-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.status-card h3 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0.5rem 0;
    color: var(--text-primary);
}

.status-card small {
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

/* Chart Container */
.chart-container {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.chart-container iframe {
    border: none;
    border-radius: var(--radius-sm);
    width: 100%;
    min-height: 600px;
    background: white;
}

/* Footer */
footer {
    background: transparent;
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
}

footer small {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.info-item {
    padding: 1rem;
    background: var(--background);
    border-radius: var(--radius-sm);
}

.info-item strong {
    display: block;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.info-item span {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-secondary);
}

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

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    .app-brand-subtitle {
        display: none;
    }
    
    main {
        padding: 1.5rem 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.75rem 0.5rem;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus states */
.btn:focus,
.nav-link:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.3s ease-out;
}
