/* ==========================================================================
   Techcess Internal Management System
   Light, minimal dashboard theme built on Bootstrap 5.
   ========================================================================== */

/* Brand colours sampled from the Techcess logo:
   indigo #261067, purple #7918d7, red #c20808. */
:root {
    --tc-primary: #2a1470;
    --tc-primary-dark: #1a0b4d;
    --tc-primary-soft: #ece9f8;
    --tc-purple: #7918d7;
    --tc-red: #c20808;
    --tc-brand-gradient: linear-gradient(90deg, #2a1470 0%, #7918d7 45%, #c20808 100%);
    --tc-surface: #ffffff;
    --tc-body: #f5f6fa;
    --tc-border: #e3e5ee;
    --tc-text: #1f2937;
    --tc-muted: #6b7280;
    --tc-sidebar-width: 250px;
    --tc-radius: 10px;

    /* Point Bootstrap's own variables at the brand palette so utility
       classes such as text-primary and bg-primary-subtle follow it too. */
    --bs-primary: #2a1470;
    --bs-primary-rgb: 42, 20, 112;
    --bs-primary-bg-subtle: #ece9f8;
    --bs-primary-border-subtle: #cec5ec;
    --bs-primary-text-emphasis: #1a0b4d;
    --bs-danger: #c20808;
    --bs-danger-rgb: 194, 8, 8;
    --bs-link-color: #2a1470;
    --bs-link-color-rgb: 42, 20, 112;
    --bs-link-hover-color: #7918d7;
    --bs-link-hover-color-rgb: 121, 24, 215;
}

body {
    background-color: var(--tc-body);
    color: var(--tc-text);
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.925rem;
}

a {
    text-decoration: none;
}

/* ---------- Shell ---------- */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    margin-left: var(--tc-sidebar-width);
}

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

.app-footer {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--tc-border);
    color: var(--tc-muted);
    font-size: 0.8rem;
    background: var(--tc-surface);
}

/* ---------- Sidebar ---------- */

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--tc-sidebar-width);
    background: var(--tc-surface);
    border-right: 1px solid var(--tc-border);
    display: flex;
    flex-direction: column;
    z-index: 1045;
    transition: transform 0.2s ease-in-out;
}

.sidebar-brand {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 1.1rem 1.15rem 1rem;
    border-bottom: 1px solid var(--tc-border);
}

/* Thin accent strip picking up the logo's purple-to-red gradient. */
.sidebar-brand::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: var(--tc-brand-gradient);
}

.brand-link {
    display: block;
    color: var(--tc-text);
    line-height: 1;
}

.brand-logo {
    width: 100%;
    max-width: 178px;
    height: auto;
    display: block;
}


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

.nav-section {
    padding: 0.85rem 0.6rem 0.35rem;
    font-size: 0.68rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--tc-muted);
    font-weight: 600;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    color: #475569;
    font-weight: 500;
    margin-bottom: 0.15rem;
}

.sidebar-nav .nav-link i {
    font-size: 1.05rem;
    width: 1.2rem;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    background: #f4f2fb;
    color: var(--tc-primary-dark);
}

.sidebar-nav .nav-link.active {
    background: var(--tc-primary-soft);
    color: var(--tc-primary-dark);
    font-weight: 600;
}

.sidebar-footer {
    border-top: 1px solid var(--tc-border);
    padding: 0.85rem 1rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.avatar-initials {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 50%;
    background: var(--tc-primary-soft);
    color: var(--tc-primary-dark);
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.avatar-initials.sm {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
    font-size: 0.75rem;
}

.avatar-initials.lg {
    width: 72px;
    height: 72px;
    flex-basis: 72px;
    font-size: 1.5rem;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1040;
}

.sidebar-backdrop.show {
    display: block;
}

/* ---------- Topbar ---------- */

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.5rem;
    background: var(--tc-surface);
    border-bottom: 1px solid var(--tc-border);
}

.topbar-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0;
}

/* ---------- Cards, tables, forms ---------- */

.card {
    border: 1px solid var(--tc-border);
    border-radius: var(--tc-radius);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.card-header {
    background: var(--tc-surface);
    border-bottom: 1px solid var(--tc-border);
    font-weight: 600;
    padding: 0.85rem 1.1rem;
    border-radius: var(--tc-radius) var(--tc-radius) 0 0 !important;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem 1.1rem;
    height: 100%;
}

.stat-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 1.2rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.1;
}

.stat-label {
    color: var(--tc-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.table {
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: 0.7rem 0.85rem;
    vertical-align: middle;
}

.table thead th {
    background: #f8fafc;
    color: var(--tc-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    border-bottom: 1px solid var(--tc-border);
    white-space: nowrap;
}

.badge {
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.35em 0.6em;
}

.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.form-control, .form-select {
    border-color: #d7dce5;
}

.form-control:focus, .form-select:focus {
    border-color: var(--tc-purple);
    box-shadow: 0 0 0 0.2rem rgba(121, 24, 215, 0.13);
}

.form-check-input:checked {
    background-color: var(--tc-primary);
    border-color: var(--tc-primary);
}

.required::after {
    content: " *";
    color: #dc3545;
}

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

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: var(--tc-primary-dark);
    border-color: var(--tc-primary-dark);
}

.btn-outline-primary {
    color: var(--tc-primary);
    border-color: var(--tc-primary);
}

.btn-outline-primary:hover, .btn-outline-primary:active {
    background-color: var(--tc-primary);
    border-color: var(--tc-primary);
}

.nav-pills .nav-link.active {
    background-color: var(--tc-primary);
}

.nav-pills .nav-link {
    color: var(--tc-primary);
}

.page-link {
    color: var(--tc-primary);
}

.page-item.active .page-link {
    background-color: var(--tc-primary);
    border-color: var(--tc-primary);
}

.filter-bar {
    background: var(--tc-surface);
    border: 1px solid var(--tc-border);
    border-radius: var(--tc-radius);
    padding: 0.9rem 1rem;
    margin-bottom: 1rem;
}

.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--tc-muted);
}

.empty-state i {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* ---------- Timeline (task updates) ---------- */

.timeline {
    list-style: none;
    margin: 0;
    padding: 0 0 0 1.35rem;
    border-left: 2px solid var(--tc-border);
}

.timeline-item {
    position: relative;
    padding: 0 0 1.15rem 1rem;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -1.47rem;
    top: 0.35rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--tc-primary);
    border: 2px solid #fff;
}

/* ---------- Login and error pages ---------- */

.blank-page {
    display: flex;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(180deg, #f7f6fc 0%, #eceaf5 100%);
    padding: 2rem 0;
}

.auth-card {
    max-width: 420px;
    margin: 0 auto;
}

.auth-brand {
    text-align: center;
    margin-bottom: 1.4rem;
}

.auth-logo {
    width: 100%;
    max-width: 260px;
    height: auto;
}

/* Gradient edge on the sign-in card, echoing the logo. */
.auth-card .card {
    border-top: 3px solid transparent;
    border-image: var(--tc-brand-gradient) 1;
}

/* ---------- Utilities ---------- */

.text-small {
    font-size: 0.82rem;
}

.cell-truncate {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress-thin {
    height: 6px;
}

@media print {
    .app-sidebar, .app-topbar, .app-footer, .filter-bar, .no-print {
        display: none !important;
    }

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

    .card {
        border: none;
        box-shadow: none;
    }
}

/* ---------- Responsive ---------- */

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

    .app-sidebar.show {
        transform: translateX(0);
    }

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

    .app-content {
        padding: 1rem;
    }

    .app-topbar {
        padding: 0.75rem 1rem;
    }
}
