/* Minimal mobile-first panel theme (wireframe-style) */

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #fafafa;
    --bg-tertiary: #f5f5f5;
    --bg-card: #ffffff;
    --bg-card-hover: #fafafa;
    --text-primary: #1a1a1a;
    --text-secondary: #525252;
    --text-muted: #737373;
    --border: #e5e5e5;
    --border-light: #d4d4d4;
    --primary: #1a1a1a;
    --primary-dark: #000000;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #ca8a04;
    --info: #0891b2;
    --purple: #7c3aed;
    --orange: #ea580c;
    --yellow: #ca8a04;
    --header-height: 56px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.08);
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    font-size: 15px;
}

/* Login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--bg-primary);
}

.login-box {
    background: var(--bg-card);
    padding: 2.5rem 1.75rem;
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-form {
    margin-top: 1.5rem;
}

/* App layout */
.app-container {
    display: flex;
    min-height: 100vh;
    background: var(--bg-secondary);
}

/* Main – full width, no sidebar */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
}

/* Header – minimal bar like wireframe */
.top-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 1rem;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.header-search {
    position: relative;
    flex: 1;
    max-width: 280px;
}

.header-search input {
    width: 100%;
    padding: 0.6rem 0.75rem 0.6rem 2.25rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.header-search input::placeholder {
    color: var(--text-muted);
}

.header-search svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.header-center {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-icon-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.header-icon-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
}

.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1rem;
    min-height: 0;
    overflow: hidden;
}

.content-wrapper > .dashboard {
    flex: 1;
    min-height: 0;
}

/* Dashboard */
.dashboard-header {
    margin-bottom: 1.5rem;
}

.dashboard-header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.dashboard-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.stat-card:hover {
    border-color: var(--border-light);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.stat-card-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }
.stat-trend-text {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.2rem;
}

/* Dashboard layout: tabs = main nav, left on desktop, top on mobile */
.dashboard {
    display: flex;
    flex-direction: row;
    gap: 0;
    min-height: 0;
    flex: 1;
}

.tab-panels {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
}

/* Tabs – vertical strip on desktop, horizontal on mobile */
.nav-tabs {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    min-width: 180px;
    max-width: 220px;
    border-bottom: none;
    border-right: 1px solid var(--border);
    margin-bottom: 0;
    margin-right: 1.5rem;
    padding-right: 1rem;
    padding-bottom: 0;
    overflow-x: visible;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    border-bottom: none;
    border-left: 2px solid transparent;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
    white-space: nowrap;
    text-align: left;
    margin-left: -1px;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.tab-btn.active {
    color: var(--text-primary);
    border-left-color: var(--primary);
    background: var(--bg-tertiary);
    font-weight: 600;
}

.tab-content {
    display: none;
    animation: fadeIn 0.25s ease;
}

.tab-content.active {
    display: block;
}

/* Mobile: tabs horizontal at top */
@media (max-width: 900px) {
    .dashboard {
        flex-direction: column;
    }

    .nav-tabs {
        flex-direction: row;
        min-width: 0;
        max-width: none;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        margin-right: 0;
        margin-bottom: 1.25rem;
        padding-right: 0;
        padding-bottom: 0;
        overflow-x: auto;
    }

    .tab-btn {
        border-left: none;
        border-bottom: 2px solid transparent;
        border-radius: 0;
        margin-left: 0;
        margin-bottom: -1px;
        flex-shrink: 0;
    }

    .tab-btn.active {
        border-left: none;
        border-bottom-color: var(--primary);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Cards – white, light border, generous padding */
.card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.card-header {
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.card-header h2,
.card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.card-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.card-header p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: border-color 0.2s;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--text-primary);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group small {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Buttons – black primary like wireframe */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
}

.btn-block {
    width: 100%;
}

/* Tables */
.data-table {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    -webkit-overflow-scrolling: touch;
}

.data-table table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--bg-tertiary);
}

.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.data-table tbody tr:hover {
    background: var(--bg-secondary);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table code {
    background: var(--bg-tertiary);
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 500;
    color: var(--text-primary);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-success {
    background: rgba(22, 163, 74, 0.12);
    color: var(--success);
}

.badge-danger {
    background: rgba(220, 38, 38, 0.12);
    color: var(--danger);
}

.badge-warning {
    background: rgba(202, 138, 4, 0.12);
    color: var(--warning);
}

.badge-info {
    background: rgba(8, 145, 178, 0.12);
    color: var(--info);
}

.badge-purple {
    background: rgba(124, 58, 237, 0.12);
    color: var(--purple);
}

/* Alerts */
.alert {
    padding: 0.9rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.alert-error {
    background: rgba(220, 38, 38, 0.08);
    color: var(--danger);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.alert-success {
    background: rgba(22, 163, 74, 0.08);
    color: var(--success);
    border: 1px solid rgba(22, 163, 74, 0.2);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    opacity: 0.4;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 0.9rem;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========== Mobile (wireframe-style) ========== */
@media (max-width: 768px) {
    :root {
        --header-height: 52px;
    }

    .content-wrapper {
        padding: 1rem;
    }

    .top-header {
        padding: 0 0.75rem;
    }

    .header-search {
        display: none;
    }

    .header-center {
        font-size: 0.8rem;
    }

    .nav-tabs {
        margin-bottom: 1.25rem;
        padding-bottom: 0;
    }

    .tab-btn {
        padding: 0.65rem 0.85rem;
        font-size: 0.85rem;
    }

    .card {
        padding: 1.25rem;
        margin-bottom: 1.25rem;
    }

    .card-header h2,
    .card-header h3 {
        font-size: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.35rem;
    }

    .btn {
        padding: 0.7rem 1.25rem;
        font-size: 0.875rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.7rem 0.9rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.6rem 0.75rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .login-box {
        padding: 1.5rem 1.25rem;
    }

    .login-header h1 {
        font-size: 1.35rem;
    }
}

/* Inline-style overrides (dashboard uses var() in style= attributes) */
details summary {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

pre {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
}
