/**
 * Safari Web Intelligence Hub
 * File: assets/css/main.css
 * Version: 1.0.0
 * Created: 2026-03-11 19:20 SAST
 * Modified: 2026-03-11 19:20 SAST
 * Author: Claude + Mike Lawrie
 * Description: Complete application styles - sidebar, cards, tables, charts
 * Changes: Initial build
 */

:root {
    --primary: #D4A574;
    --primary-dark: #B8865A;
    --primary-light: #E8C9A8;
    --secondary: #1A2332;
    --secondary-light: #2A3544;
    --success: #2D5F3F;
    --warning: #E89B3C;
    --danger: #8B1E1E;
    --bg: #F5F3EF;
    --bg-card: #FFFFFF;
    --text: #1A2332;
    --text-muted: #6B7280;
    --border: #E5E2DC;
    --shadow: 0 1px 3px rgba(26,35,50,0.06), 0 1px 2px rgba(26,35,50,0.04);
    --shadow-md: 0 4px 6px rgba(26,35,50,0.07), 0 2px 4px rgba(26,35,50,0.04);
    --radius: 8px;
    --radius-lg: 12px;
    --sidebar-width: 240px;
    --topbar-height: 56px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
}

/* App Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--secondary);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-text {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: var(--primary);
}

.property-selector {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.property-selector select {
    width: 100%;
    padding: 8px 10px;
    background: var(--secondary-light);
    color: var(--primary);
    border: 1px solid rgba(212,165,116,0.3);
    border-radius: var(--radius);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23D4A574' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

.nav-item.active {
    color: var(--primary);
    background: rgba(212,165,116,0.08);
    border-left-color: var(--primary);
}

.nav-item i, .nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.user-info {
    padding: 8px 4px;
    margin-bottom: 4px;
}

.user-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.user-role {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.top-bar {
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.current-property-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-dark);
    background: rgba(212,165,116,0.15);
    padding: 4px 12px;
    border-radius: 20px;
}

.content-area {
    padding: 24px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.card-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Grid */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

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

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg { width: 22px; height: 22px; }

.stat-value {
    font-family: 'Poppins', sans-serif;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-trend {
    font-size: 11px;
    font-weight: 600;
    margin-top: 2px;
}

.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* Health Score */
.health-score {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Poppins', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.health-good { background: var(--success); }
.health-warn { background: var(--warning); }
.health-bad { background: var(--danger); }

/* Tables */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    background: rgba(245,243,239,0.5);
}

td {
    padding: 10px 12px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tr:hover td {
    background: rgba(212,165,116,0.04);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover { background: var(--primary-dark); }

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

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

.btn-sm { padding: 5px 10px; font-size: 12px; }

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

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

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    background: var(--bg-card);
    transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(212,165,116,0.15);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin: 0 24px 16px;
    font-size: 13px;
    font-weight: 500;
}

.alert-success { background: rgba(45,95,63,0.1); color: var(--success); border: 1px solid rgba(45,95,63,0.2); }
.alert-warning { background: rgba(232,155,60,0.1); color: #96620e; border: 1px solid rgba(232,155,60,0.2); }
.alert-danger { background: rgba(139,30,30,0.1); color: var(--danger); border: 1px solid rgba(139,30,30,0.2); }
.alert-info { background: rgba(212,165,116,0.1); color: var(--primary-dark); border: 1px solid rgba(212,165,116,0.2); }

/* Insight Cards */
.insight-card {
    padding: 14px 16px;
    border-radius: var(--radius);
    border-left: 4px solid var(--border);
    background: var(--bg-card);
    margin-bottom: 12px;
}

.insight-card.critical { border-left-color: var(--danger); }
.insight-card.high { border-left-color: #c0392b; }
.insight-card.medium { border-left-color: var(--warning); }
.insight-card.low { border-left-color: var(--success); }

.insight-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.insight-body {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Goal Cards */
.goal-card {
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    margin-bottom: 12px;
}

.goal-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.goal-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Chart container */
.chart-container {
    position: relative;
    width: 100%;
    max-height: 300px;
}

/* Login page */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--secondary);
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-brand {
    text-align: center;
    margin-bottom: 32px;
}

.login-brand h1 {
    font-size: 20px;
    color: var(--primary-dark);
    margin-top: 12px;
}

.login-brand p {
    font-size: 13px;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .content-area {
        padding: 16px;
    }
}

/* Mono for data */
.mono { font-family: 'IBM Plex Mono', monospace; }

/* Utility */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary-dark); }
.fw-600 { font-weight: 600; }
.mb-0 { margin-bottom: 0; }
.mt-16 { margin-top: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
