:root {
    --primary-color: #667eea;
    --primary-hover: #764ba2;
    --primary-light: #8b9bef;
    --secondary-color: #6B7280;
    --success-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --info-color: #06B6D4;
    --light-color: #F9FAFB;
    --dark-color: #1F2937;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

* {
    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: #f5f7fa;
    padding-bottom: 0;
    padding-top: calc(70px + env(safe-area-inset-top));
    /* Extend into safe area on iOS */
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    /* Flexbox for sticky footer */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.has-mobile-nav {
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
}

/* Sticky Header */
.sticky-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: 70px;
    height: calc(70px + env(safe-area-inset-top));
    background: var(--gradient-primary);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Extend into safe area on iOS */
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.sticky-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-weight: 600;
}

.sticky-header-content i {
    font-size: 32px;
    color: white;
}

.sticky-header-title {
    font-size: 26px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.sticky-header-subtitle {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
    padding: 2px 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.navbar-nav {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.navbar-nav a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.navbar-nav a:hover {
    color: var(--primary-color);
}

/* Desktop Navigation */
.desktop-nav {
    display: block;
}

.mobile-bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    .desktop-nav {
        display: none;
    }
    
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        justify-content: space-around;
        padding: 8px 0;
        /* Extend into safe area on iOS */
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: var(--secondary-color);
        font-size: 12px;
        padding: 8px;
        transition: color 0.3s;
    }
    
    .mobile-nav-item i {
        font-size: 20px;
        margin-bottom: 4px;
    }
    
    .mobile-nav-item.active {
        color: var(--primary-color);
    }
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-color);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    text-align: center;
}

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

.btn-primary:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

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

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

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

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

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
}

.alert-success {
    background-color: #D1FAE5;
    color: #065F46;
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    background-color: #FEE2E2;
    color: #991B1B;
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background-color: #FEF3C7;
    color: #92400E;
    border-left: 4px solid var(--warning-color);
}

.alert-info {
    background-color: #DBEAFE;
    color: #1E40AF;
    border-left: 4px solid var(--info-color);
}

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

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--dark-color);
}

.stat-label {
    color: var(--secondary-color);
    font-size: 0.875rem;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

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

.table th {
    background-color: var(--light-color);
    font-weight: 600;
    color: var(--dark-color);
}

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

/* Landing Page */
.hero {
    text-align: center;
    padding: 4rem 2rem;
}

.hero h1 {
    font-size: 3rem;
    color: var(--dark-color);
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.25rem;
    color: var(--secondary-color);
    margin-bottom: 2rem;
}

/* Auth Forms */
.auth-container {
    max-width: 500px;
    margin: 3rem auto;
}

.auth-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h2 {
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Grafana Embed */
.grafana-embed {
    width: 100%;
    height: 800px;
    min-height: 600px;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Footer */
html {
    height: 100%;
}

/* Main content should grow to push footer down */
.main-content {
    flex: 1 0 auto;
}

.footer {
    flex-shrink: 0;
    background-color: #f8f9fa !important;
    border-top: 1px solid #e9ecef;
    margin-top: 3rem;
    padding: 1.5rem 0 !important;
    font-size: 0.9rem;
}

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

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.footer .badge {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    font-weight: 500;
}

.footer .badge.bg-primary {
    background: var(--gradient-primary) !important;
}

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

.footer .badge.bg-info {
    background-color: var(--info-color) !important;
}

/* Mobile footer adjustments */
@media (max-width: 768px) {
    .footer {
        padding-bottom: calc(1.5rem + 70px + env(safe-area-inset-bottom)) !important;
    }
    
    .footer .row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .footer .col-md-6 {
        width: 100%;
    }
}

