/* ==========================================================
   PETRA ERP - GLOBAL APPLICATION STYLES
========================================================== */

:root {
    --sidebar: #0f172a;
    --sidebar-hover: rgba(255,255,255,.06);
    --sidebar-border: rgba(255,255,255,.07);

    --primary: #2563eb;
    --primary-dark: #1d4ed8;

    --background: #f5f7fb;
    --surface: #ffffff;
    --border: #e5e7eb;

    --text: #172033;
    --text-dark: #0f172a;
    --muted: #667085;

    --danger: #dc2626;
    --success: #16a34a;
}


/* ==========================================================
   GLOBAL
========================================================== */

* {
    box-sizing: border-box;
}


html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}


body {
    font-family:
        Arial,
        Helvetica,
        sans-serif;

    background: var(--background);
    color: var(--text);

    font-size: 14px;
}


a {
    color: var(--primary);
    text-decoration: none;
}


button,
input,
textarea,
select {
    font: inherit;
}


/* ==========================================================
   APPLICATION SHELL
========================================================== */

.app-shell {
    min-height: 100vh;
    display: flex;
    background: var(--background);
}


/* ==========================================================
   SIDEBAR
========================================================== */

.sidebar {
    width: 250px;
    min-width: 250px;

    height: 100vh;

    position: fixed;
    left: 0;
    top: 0;

    display: flex;
    flex-direction: column;

    background: var(--sidebar);
    color: #ffffff;

    border-right:
        1px solid
        var(--sidebar-border);

    z-index: 1000;
}


/* ==========================================================
   BRAND
========================================================== */

.brand {
    height: 92px;

    padding:
        17px
        20px;

    display: flex;
    align-items: center;

    border-bottom:
        1px solid
        var(--sidebar-border);
}


.brand-link {
    width: 100%;

    display: flex;
    align-items: center;

    gap: 12px;

    text-decoration: none;
}


.brand-logo {
    width: 54px;
    height: 54px;

    object-fit: contain;

    background: #ffffff;

    border-radius: 12px;

    padding: 5px;

    flex-shrink: 0;
}


.brand-text {
    display: flex;
    flex-direction: column;

    line-height: 1.1;
}


.brand-text strong {
    color: #ffffff;

    font-size: 17px;

    font-weight: 800;

    letter-spacing: .2px;
}


.brand-text span {
    margin-top: 5px;

    color: #94a3b8;

    font-size: 10px;

    font-weight: 700;

    letter-spacing: 1.8px;

    text-transform: uppercase;
}


/* ==========================================================
   SIDEBAR NAVIGATION
========================================================== */

.sidebar-nav {
    flex: 1;

    overflow-y: auto;

    overflow-x: hidden;

    padding:
        15px
        12px;
}


/* Scrollbar */

.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}


.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}


.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.12);
    border-radius: 10px;
}


/* ==========================================================
   NAVIGATION SECTIONS
========================================================== */

.nav-section {
    margin-bottom: 19px;
}


.nav-section:last-child {
    margin-bottom: 0;
}


.nav-section-title {
    padding:
        0
        12px;

    margin-bottom: 7px;

    color: #64748b;

    font-size: 9px;

    font-weight: 800;

    letter-spacing: 1.4px;

    text-transform: uppercase;
}


/* ==========================================================
   NAV ITEM
========================================================== */

.nav-item {
    min-height: 43px;

    width: 100%;

    padding:
        0
        12px;

    margin-bottom: 3px;

    display: flex;
    align-items: center;

    gap: 11px;

    border-radius: 9px;

    color: #cbd5e1;

    text-decoration: none;

    font-size: 12px;

    font-weight: 650;

    transition:
        background .15s ease,
        color .15s ease,
        transform .15s ease;
}


.nav-item:hover {
    color: #ffffff;

    background:
        var(--sidebar-hover);
}


.nav-item:active {
    transform: translateY(1px);
}


/* ==========================================================
   ACTIVE NAV ITEM
========================================================== */

.nav-item.active {
    color: #ffffff;

    background:
        var(--primary);

    box-shadow:
        0 5px 14px
        rgba(37,99,235,.25);
}


.nav-item.active:hover {
    background:
        var(--primary-dark);
}


/* ==========================================================
   NAV ICON
========================================================== */

.nav-icon {
    width: 20px;
    height: 20px;

    flex: 0 0 20px;

    display: flex;
    align-items: center;
    justify-content: center;
}


.nav-icon svg {
    width: 17px;
    height: 17px;

    fill: none;

    stroke: currentColor;

    stroke-width: 1.8;

    stroke-linecap: round;

    stroke-linejoin: round;
}


.nav-label {
    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}


/* ==========================================================
   SIDEBAR BOTTOM
========================================================== */

.sidebar-bottom {
    padding:
        12px;

    border-top:
        1px solid
        var(--sidebar-border);
}


.sidebar-bottom .nav-item {
    margin-bottom: 0;
}


/* ==========================================================
   LOGOUT
========================================================== */

.logout-item {
    color: #94a3b8;
}


.logout-item:hover {
    color: #f87171;

    background:
        rgba(248,113,113,.08);
}


/* ==========================================================
   MAIN CONTENT
========================================================== */

.main-content {
    margin-left: 250px;

    width:
        calc(100% - 250px);

    min-width: 0;

    min-height: 100vh;

    background:
        var(--background);
}


/* ==========================================================
   TOPBAR
========================================================== */

.topbar {
    height: 64px;

    background:
        var(--surface);

    border-bottom:
        1px solid
        var(--border);

    display: flex;

    justify-content:
        space-between;

    align-items: center;

    padding:
        0
        28px;

    position: sticky;

    top: 0;

    z-index: 100;
}


.topbar-title {
    color:
        var(--text-dark);

    font-size: 18px;

    font-weight: 800;
}


.topbar-user {
    display: flex;

    align-items: center;

    gap: 9px;
}


.user-avatar {
    width: 34px;
    height: 34px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background:
        #e8f0ff;

    color:
        var(--primary);

    font-size: 12px;

    font-weight: 800;
}


.user-name {
    color:
        var(--muted);

    font-size: 12px;

    font-weight: 500;
}


/* ==========================================================
   PAGE
========================================================== */

.page {
    padding: 26px;
}


/* ==========================================================
   PAGE HEADER
========================================================== */

.page-head {
    display: flex;

    justify-content:
        space-between;

    align-items: center;

    gap: 15px;

    margin-bottom: 20px;
}


.page-head h1 {
    margin: 0;

    color:
        var(--text-dark);

    font-size: 25px;

    font-weight: 800;
}


/* ==========================================================
   CARDS
========================================================== */

.card {
    background:
        var(--surface);

    border:
        1px solid
        var(--border);

    border-radius:
        10px;

    padding:
        20px;

    margin-bottom:
        20px;
}


/* ==========================================================
   TOOLBAR
========================================================== */

.toolbar {
    display: flex;

    flex-wrap: wrap;

    gap: 10px;

    align-items: center;

    margin-bottom: 16px;
}


.search-box {
    flex: 1;

    min-width: 220px;
}


/* ==========================================================
   FORM ELEMENTS
========================================================== */

input,
textarea,
select {
    width: 100%;

    padding:
        10px
        11px;

    border:
        1px solid
        #d0d5dd;

    border-radius:
        7px;

    background:
        #ffffff;

    color:
        var(--text);

    outline: none;
}


input:focus,
textarea:focus,
select:focus {
    border-color:
        var(--primary);

    box-shadow:
        0 0 0 3px
        rgba(37,99,235,.08);
}


textarea {
    min-height: 100px;

    resize: vertical;
}


/* ==========================================================
   FORM GRID
========================================================== */

.form-grid {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0,1fr)
        );

    gap: 16px;
}


.form-group label {
    display: block;

    font-weight: 600;

    margin-bottom: 6px;
}


.form-group.full {
    grid-column:
        1 / -1;
}


/* ==========================================================
   BUTTONS
========================================================== */

.btn {
    display: inline-flex;

    align-items: center;

    justify-content: center;

    gap: 6px;

    border: 0;

    border-radius: 7px;

    padding:
        10px
        15px;

    background:
        var(--primary);

    color:
        #ffffff;

    cursor: pointer;

    font-weight: 700;

    text-decoration: none;

    transition:
        background .15s ease,
        transform .15s ease;
}


.btn:hover {
    background:
        var(--primary-dark);
}


.btn:active {
    transform:
        translateY(1px);
}


.btn.secondary {
    background:
        #667085;
}


.btn.secondary:hover {
    background:
        #475467;
}


.btn.danger {
    background:
        var(--danger);
}


.btn.danger:hover {
    background:
        #b91c1c;
}


.btn.light {
    background:
        #eef2f7;

    color:
        var(--text);
}


.btn.light:hover {
    background:
        #e2e8f0;
}


/* ==========================================================
   TABLES
========================================================== */

table {
    width: 100%;

    border-collapse:
        collapse;

    background:
        #ffffff;
}


th,
td {
    padding:
        12px;

    border-bottom:
        1px solid
        var(--border);

    text-align:
        left;

    vertical-align:
        middle;
}


th {
    font-size:
        13px;

    color:
        var(--muted);

    background:
        #f8fafc;

    font-weight:
        700;
}


tbody tr:hover td {
    background:
        #fafcff;
}


/* ==========================================================
   ACTIONS
========================================================== */

.actions {
    display: flex;

    gap: 7px;

    flex-wrap: wrap;
}


.actions .btn {
    vertical-align:
        middle;
}


/* ==========================================================
   PAGINATION
========================================================== */

.pagination {
    display: flex;

    gap: 6px;

    flex-wrap: wrap;

    align-items: center;

    margin-top: 18px;
}


.pagination a,
.pagination span {
    padding:
        7px
        10px;

    border:
        1px solid
        var(--border);

    border-radius:
        6px;

    background:
        #ffffff;
}


.pagination .current {
    background:
        var(--primary);

    color:
        #ffffff;

    border-color:
        var(--primary);
}


/* ==========================================================
   EMPTY STATE
========================================================== */

.empty {
    text-align:
        center;

    padding:
        35px;

    color:
        var(--muted);
}


/* ==========================================================
   ALERT
========================================================== */

.alert {
    padding:
        11px
        14px;

    border-radius:
        7px;

    background:
        #fef2f2;

    color:
        #991b1b;

    margin-bottom:
        16px;
}


/* ==========================================================
   FOOTER
========================================================== */

.app-footer {
    margin-left:
        250px;

    padding:
        17px
        24px;

    text-align:
        center;

    color:
        var(--muted);

    font-size:
        13px;

    background:
        #ffffff;

    border-top:
        1px solid
        var(--border);
}


.app-footer a {
    font-weight:
        600;
}


/* ==========================================================
   HORIZONTAL RULE
========================================================== */

hr {
    border:
        0;

    border-top:
        1px solid
        var(--border);
}


/* ==========================================================
   RESPONSIVE - TABLET
========================================================== */

@media (max-width: 900px) {

    .sidebar {
        width: 220px;
        min-width: 220px;
    }


    .main-content {
        margin-left: 220px;

        width:
            calc(100% - 220px);
    }


    .app-footer {
        margin-left:
            220px;
    }


    .form-grid {
        grid-template-columns:
            1fr;
    }


    .page {
        padding:
            18px;
    }


    .topbar {
        padding:
            0
            18px;
    }

}


/* ==========================================================
   RESPONSIVE - MOBILE
========================================================== */

@media (max-width: 650px) {

    .sidebar {
        width: 70px;
        min-width: 70px;
    }


    .brand {
        height: 72px;

        padding:
            12px;

        justify-content:
            center;
    }


    .brand-link {
        justify-content:
            center;
    }


    .brand-logo {
        width: 42px;
        height: 42px;
    }


    .brand-text {
        display:
            none;
    }


    .sidebar-nav {
        padding:
            12px
            8px;
    }


    .nav-section-title {
        display:
            none;
    }


    .nav-section {
        margin-bottom:
            10px;
    }


    .nav-item {
        justify-content:
            center;

        padding:
            0;
    }


    .nav-label {
        display:
            none;
    }


    .nav-icon {
        width: 20px;
        flex-basis: 20px;
    }


    .main-content {
        margin-left:
            70px;

        width:
            calc(100% - 70px);
    }


    .app-footer {
        margin-left:
            70px;

        padding:
            14px;
    }


    .topbar {
        padding:
            0
            12px;
    }


    .topbar-title {
        font-size:
            15px;
    }


    .user-name {
        display:
            none;
    }


    .page {
        padding:
            14px;
    }


    .page-head {
        align-items:
            flex-start;

        flex-direction:
            column;
    }


    table {
        display:
            block;

        overflow-x:
            auto;

        white-space:
            nowrap;
    }

}