/* ============================================================
   FOCUS Device Planner — Main Styles
   ============================================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-secondary: #64748b;
    --color-danger: #dc2626;
    --color-danger-hover: #b91c1c;
    --color-success: #16a34a;
    --color-warning: #f59e0b;
    --color-bg: #f1f5f9;
    --color-surface: #ffffff;
    --color-border: #e2e8f0;
    --color-text: #1e293b;
    --color-text-muted: #94a3b8;
    --color-sidebar: #0f172a;
    --color-sidebar-hover: #1e293b;
    --color-sidebar-text: #cbd5e1;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --transition: 150ms ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--color-primary);
    color: white;
}
.btn-primary:hover { background: var(--color-primary-hover); }

.btn-secondary {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text);
}
.btn-secondary:hover { background: var(--color-bg); }

.btn-danger {
    background: var(--color-danger);
    color: white;
}
.btn-danger:hover { background: var(--color-danger-hover); }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-draft { background: #e2e8f0; color: #475569; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-archived { background: #fef3c7; color: #92400e; }
.badge-locked { background: #fee2e2; color: #991b1b; }
.badge-primary { background: #dbeafe; color: #1e40af; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-admin { background: #f3e8ff; color: #6b21a8; }

/* --- Forms --- */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 4px; font-size: 13px; }
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color var(--transition);
    background: var(--color-surface);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-error { background: #fee2e2; color: #991b1b; padding: 8px 12px; border-radius: var(--radius); font-size: 13px; margin-bottom: 12px; }
.full-width { width: 100%; }
.check-list { max-height: 150px; overflow-y: auto; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 8px; margin: 8px 0; }
.check-list label { display: block; font-size: 13px; padding: 2px 0; }

/* --- Tables --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.data-table th, .data-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
}
.data-table th {
    background: var(--color-bg);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    color: var(--color-secondary);
}
.data-table tr:hover td { background: #f8fafc; }

/* --- Cards --- */
.card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.card-header h3, .card-header h4 { font-size: 15px; margin: 0; }
.card-body { padding: 14px 16px; }
.card-body p { margin-bottom: 4px; font-size: 13px; }
.card-actions {
    padding: 10px 16px;
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

/* --- Loading / Empty --- */
.loading { color: var(--color-text-muted); padding: 40px; text-align: center; font-size: 14px; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--color-text-muted); }
.empty-state p { margin-bottom: 12px; }
.text-muted { color: var(--color-text-muted); }
.text-danger { color: var(--color-danger); }
.hidden { display: none !important; }

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}
.modal {
    background: var(--color-surface);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
}
.modal-body { padding: 24px; }
.modal-body h3 { margin-bottom: 16px; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* --- App Layout --- */
.app-layout { display: flex; min-height: 100vh; }
.main-content { flex: 1; padding: 24px; overflow-y: auto; }

/* --- Page Header --- */
.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.page-header h2 { font-size: 22px; flex: 1; }
.header-actions { display: flex; gap: 8px; }

/* --- Tabs --- */
.project-tabs, .admin-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 16px;
}
.tab {
    padding: 10px 20px;
    border: none;
    background: transparent;
    font-size: 14px;
    cursor: pointer;
    color: var(--color-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
}
.tab:hover { color: var(--color-text); }
.tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: 600; }

/* --- Inline Form --- */
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.inline-form input, .inline-form select { padding: 6px 10px; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: 13px; }

/* --- Sidebar --- */
.sidebar {
    width: 220px;
    background: var(--color-sidebar);
    color: var(--color-sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.sidebar-brand {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-brand h1 { font-size: 16px; color: white; }
.sidebar-brand small { font-size: 11px; color: var(--color-text-muted); }
.sidebar-nav { flex: 1; padding: 8px 0; }
.nav-link {
    display: block;
    padding: 10px 16px;
    color: var(--color-sidebar-text);
    font-size: 14px;
    transition: all var(--transition);
    text-decoration: none;
}
.nav-link:hover { background: var(--color-sidebar-hover); color: white; text-decoration: none; }
.nav-link.active { background: var(--color-primary); color: white; }
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.user-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 13px; }
