/**
 * TDH Stock & Order Management System
 * Custom Design System & ERP Styling
 * Tenali Double Horse (TDH) Branding
 */

:root {
    --tdh-navy-dark: #0a1128;
    --tdh-navy: #1e293b;
    --tdh-navy-light: #334155;
    --tdh-gold: #f59e0b;
    --tdh-gold-dark: #d97706;
    --tdh-red: #dc2626;
    --tdh-red-dark: #b91c1c;
    --tdh-green: #059669;
    --tdh-blue: #2563eb;
    --tdh-purple: #7c3aed;
    --tdh-bg: #f8fafc;
    --tdh-card-bg: #ffffff;
    --tdh-border: #e2e8f0;
    --tdh-text-main: #0f172a;
    --tdh-text-muted: #64748b;
    --sidebar-width: 260px;
    --navbar-height: 64px;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--tdh-bg);
    color: var(--tdh-text-main);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* APP SHELL LAYOUT */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--tdh-navy);
    color: #f1f5f9;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    box-shadow: 4px 0 15px rgba(0,0,0,0.06);
    transition: all 0.25s ease;
}

.sidebar-brand {
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    background: var(--tdh-navy-dark);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-badge {
    background: var(--tdh-gold);
    color: var(--tdh-navy-dark);
    font-weight: 800;
    font-size: 0.9rem;
    padding: 4px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    margin-right: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.brand-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.2px;
    line-height: 1.2;
}
.brand-sub {
    font-size: 0.72rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 500;
}

.sidebar-user {
    padding: 1rem 1.25rem;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

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

.nav-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
    padding: 0.5rem 1.25rem 0.25rem;
    font-weight: 600;
}

.app-sidebar .nav-link {
    display: flex;
    align-items: center;
    padding: 0.7rem 1.25rem;
    color: #cbd5e1;
    font-size: 0.92rem;
    font-weight: 500;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.15s ease-in-out;
}

.app-sidebar .nav-link i {
    font-size: 1.15rem;
    margin-right: 0.85rem;
    color: #94a3b8;
    transition: color 0.15s;
}

.app-sidebar .nav-link:hover {
    color: #ffffff;
    background-color: rgba(255,255,255,0.06);
}
.app-sidebar .nav-link:hover i {
    color: var(--tdh-gold);
}

.app-sidebar .nav-link.active {
    color: #ffffff;
    background-color: rgba(245, 158, 11, 0.12);
    border-left-color: var(--tdh-gold);
    font-weight: 600;
}
.app-sidebar .nav-link.active i {
    color: var(--tdh-gold);
}

.app-sidebar .nav-link .badge {
    margin-left: auto;
}

.sidebar-footer {
    padding: 0.85rem 1.25rem;
    background: var(--tdh-navy-dark);
    border-top: 1px solid rgba(255,255,255,0.08);
}

/* MAIN CONTENT AREA */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left 0.25s ease;
}

/* TOP NAVBAR */
.app-navbar {
    height: var(--navbar-height);
    background: #ffffff;
    border-bottom: 1px solid var(--tdh-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--tdh-text-main);
    margin: 0;
}

.app-content {
    flex: 1;
    padding: 1.5rem;
}

/* CARDS & METRICS */
.card {
    border: 1px solid var(--tdh-border);
    border-radius: 0.65rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    background-color: #ffffff;
    transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 1.25rem;
    border-radius: 0.65rem;
    border: 1px solid var(--tdh-border);
    background: #ffffff;
}
.stat-card:hover {
    box-shadow: 0 6px 14px rgba(0,0,0,0.06);
    transform: translateY(-2px);
}
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
}
.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--tdh-text-main);
    line-height: 1.2;
    margin-top: 0.35rem;
}
.stat-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--tdh-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* TABLES */
.table {
    margin-bottom: 0;
    color: var(--tdh-text-main);
    vertical-align: middle;
}
.table thead th {
    background-color: #f8fafc;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 1px solid var(--tdh-border);
    padding: 0.75rem 0.9rem;
    white-space: nowrap;
}
.table tbody td {
    padding: 0.85rem 0.9rem;
    border-bottom: 1px solid var(--tdh-border);
    font-size: 0.9rem;
}
.table-hover tbody tr:hover {
    background-color: #f1f5f9;
}

/* STOCK OVERVIEW MATRIX */
.table-matrix thead th {
    text-align: center;
}
.table-matrix thead th.text-start {
    text-align: left;
}
.table-matrix td.company-col {
    text-align: center;
    background-color: #fafbfd;
    font-size: 0.88rem;
}
.table-matrix tr:hover td.company-col {
    background-color: #f1f5f9;
}

/* BADGES */
.badge {
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 0.45em 0.7em;
    border-radius: 6px;
}

/* BUTTONS */
.btn {
    font-weight: 600;
    border-radius: 6px;
    padding: 0.45rem 0.95rem;
    font-size: 0.88rem;
    transition: all 0.15s ease;
}
.btn-primary {
    background-color: var(--tdh-blue);
    border-color: var(--tdh-blue);
}
.btn-primary:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
}
.btn-warning {
    background-color: var(--tdh-gold);
    border-color: var(--tdh-gold);
    color: #0f172a;
}
.btn-warning:hover {
    background-color: var(--tdh-gold-dark);
    border-color: var(--tdh-gold-dark);
    color: #ffffff;
}
.btn-danger {
    background-color: var(--tdh-red);
    border-color: var(--tdh-red);
}
.btn-danger:hover {
    background-color: var(--tdh-red-dark);
    border-color: var(--tdh-red-dark);
}

/* LOGIN SCREEN */
.login-body {
    background: linear-gradient(135deg, var(--tdh-navy-dark) 0%, #1e293b 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.login-card {
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    overflow: hidden;
}
.login-header {
    background: var(--tdh-navy);
    padding: 2rem 1.5rem 1.75rem;
    text-align: center;
    border-bottom: 3px solid var(--tdh-gold);
}

/* QUICK DEMO PILLS ON LOGIN */
.demo-account-pill {
    cursor: pointer;
    border: 1px solid var(--tdh-border);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    transition: all 0.15s;
    background: #f8fafc;
}
.demo-account-pill:hover {
    background: #e2e8f0;
    border-color: var(--tdh-gold);
}

/* RESPONSIVE TOGGLE */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.show {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
}
