
/* =====================================================
   ZANASOFT LOGISTICS
   Responsive Design System
   Desktop / Tablet / Mobile
   Theme: Premium Green + Dark Sidebar
===================================================== */

/* 01. VARIABLES */
:root {
    --bg: #f4f7f5;
    --sidebar: #202b29;
    --sidebar-hover: #30413b;
    --panel: #ffffff;
    --panel2: #f7faf8;
    --border: #e4ebe6;

    --text: #25332d;
    --muted: #77867e;

    --green: #176b4a;
    --green-hover: #10583b;
    --green-soft: #e8f3ec;

    --blue: #3977a8;
    --danger: #c84b4b;
    --warning: #b98228;
    --success: #218456;

    --shadow: 0 3px 14px rgba(30, 55, 42, .045);
    --shadow-hover: 0 7px 22px rgba(30, 55, 42, .09);

    --radius: 12px;
    --radius-sm: 8px;

    --sidebar-width: 250px;
    --topbar-height: 70px;
    --content-max: 1650px;
}

/* 02. RESET */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont,
        "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: .6;
}

h1,
h2,
h3,
h4,
p {
    overflow-wrap: break-word;
}

h1,
h2,
h3,
h4 {
    color: var(--text);
}

/* 03. MAIN LAYOUT */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.main-content {
    flex: 1;
    min-width: 0;
    width: calc(100% - var(--sidebar-width));
}

/* 04. SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    padding: 24px 16px;
    background: var(--sidebar);
    border-right: 1px solid rgba(255,255,255,.05);

    display: flex;
    flex-direction: column;
    flex-shrink: 0;

    color: #e8f0eb;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 36px 8px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex-shrink: 0;

    border-radius: 12px;
    background: var(--green);
    color: #fff;

    font-size: 23px;
    font-weight: 800;
}

.brand strong {
    display: block;
    color: #fff;
    font-size: 15px;
    letter-spacing: 2px;
}

.brand small {
    display: block;
    margin-top: 4px;
    color: #9eafa5;
    font-size: 9px;
    letter-spacing: 1px;
}

/* 05. DESKTOP NAVIGATION */
.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.nav-label {
    margin: 18px 10px 10px;
    color: #899c91;
    font-size: 10px;
    letter-spacing: 1.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    min-height: 43px;
    padding: 11px 12px;
    margin: 3px 0;

    border-radius: 8px;
    color: #c1cec5;

    font-size: 13px;
    transition: background .2s, color .2s;
}

.nav-item:hover,
.nav-item.active {
    background: var(--sidebar-hover);
    color: #fff;
}

.nav-item.active {
    box-shadow: inset 3px 0 0 #62b88a;
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    margin-right: 8px;
    font-size: 16px;
}

/* 06. USER AREA */
.sidebar-bottom {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,.1);
}

.user-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.avatar {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    flex-shrink: 0;

    border-radius: 50%;
    background: #40554a;
    color: white;
}

.user-mini strong,
.user-mini small {
    display: block;
    font-size: 12px;
}

.user-mini small {
    margin-top: 4px;
    color: #a3b2a9;
}

.logout-link {
    display: block;
    margin: 18px 0 0 5px;
    color: #f0a2a2;
    font-size: 12px;
}

/* 07. TOPBAR */
.topbar {
    min-height: var(--topbar-height);
    padding: 0 32px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;

    background: #fff;
    border-bottom: 1px solid var(--border);
}

.topbar-title {
    font-size: 15px;
    font-weight: 650;
}

.topbar-right {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 7px;
    border-radius: 50%;
    background: var(--success);
}

/* 08. CONTENT */
.content-area {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 30px 32px;
}

.welcome-row,
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 25px;
}

h1 {
    margin: 0 0 8px;
    font-size: 25px;
    font-weight: 700;
    letter-spacing: -.5px;
    line-height: 1.3;
}

h2 {
    margin: 0 0 7px;
    font-size: 19px;
    font-weight: 650;
}

h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 650;
}

p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.date-chip {
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

/* 09. STATISTICS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 17px;
    margin-bottom: 38px;
}

.stat-card,
.module-card {
    min-width: 0;
    padding: 21px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.stat-card span,
.stat-card small {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.stat-card strong {
    display: block;
    margin: 14px 0 7px;
    color: var(--text);
    font-size: 29px;
    font-weight: 700;
    line-height: 1.2;
}

/* 10. MODULES */
.section-heading {
    margin-bottom: 16px;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 17px;
}

.module-card {
    min-height: 175px;
    transition: transform .2s, border-color .2s, box-shadow .2s;
}

.module-card:hover {
    transform: translateY(-2px);
    border-color: #b8d5c2;
    box-shadow: var(--shadow-hover);
}

.module-icon {
    margin-bottom: 15px;
    color: var(--green);
    font-size: 25px;
}

.module-card h3 {
    color: var(--text);
}

.module-card p {
    min-height: 40px;
}

.module-card span {
    color: var(--green);
    font-size: 11px;
    font-weight: 650;
}

/* 11. TABLES */
.table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;

    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}

table {
    width: 100%;
    min-width: 650px;
    border-collapse: collapse;
}

th,
td {
    padding: 13px 15px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 12px;
}

th {
    background: #f7faf8;
    color: #64756a;
    font-weight: 650;
    white-space: nowrap;
}

td {
    color: var(--text);
}

tbody tr:hover {
    background: #f8fbf9;
}

tbody tr:last-child td {
    border-bottom: 0;
}

/* 12. FORMS */
.form-group {
    margin-bottom: 17px;
}

.form-group label,
label {
    display: block;
    margin-bottom: 7px;
    color: #53645a;
    font-size: 12px;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    min-height: 43px;
    padding: 10px 12px;

    border: 1px solid #dce5df;
    border-radius: 8px;
    outline: none;

    background: #fff;
    color: var(--text);

    transition: border-color .2s, box-shadow .2s;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #66a984;
    box-shadow: 0 0 0 3px rgba(23,107,74,.09);
}

/* 13. BUTTONS */
.btn-primary,
.btn-secondary,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    min-height: 42px;
    padding: 10px 17px;

    border: 0;
    border-radius: 8px;

    font-size: 13px;
    font-weight: 650;

    transition: background .2s, transform .2s;
}

.btn-primary {
    background: var(--green);
    color: white;
}

.btn-primary:hover {
    background: var(--green-hover);
}

.btn-secondary {
    border: 1px solid #dce8df;
    background: #edf3ef;
    color: #365747;
}

.btn-secondary:hover {
    background: #e2eee6;
}

.btn-danger {
    border: 1px solid #f3dada;
    background: #fff0f0;
    color: var(--danger);
}

/* 14. BADGES */
.badge,
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 650;
}

.badge-success {
    background: #e8f5ed;
    color: #21764a;
}

.badge-warning {
    background: #fff5e5;
    color: #9b6819;
}

.badge-danger {
    background: #fff0f0;
    color: #b43f3f;
}

/* 15. FOOTER */
.footer {
    padding: 20px 32px;
    border-top: 1px solid var(--border);
    background: #fff;
    color: #8a9990;
    font-size: 11px;
}

.footer span {
    float: right;
}

/* 16. LOGIN */
.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

/* 17. MOBILE NAVIGATION */
.mobile-bottom-nav {
    display: none;
}

/* =====================================================
   18. TABLET
===================================================== */
@media (max-width: 1100px) {
    :root {
        --sidebar-width: 220px;
    }

    .content-area {
        padding: 24px 20px;
    }

    .topbar {
        padding: 0 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .modules-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* =====================================================
   19. SMALL TABLET
===================================================== */
@media (max-width: 800px) {
    :root {
        --sidebar-width: 190px;
    }

    .sidebar {
        padding: 20px 10px;
    }

    .brand {
        margin-left: 4px;
        gap: 8px;
    }

    .brand strong {
        font-size: 13px;
    }

    .nav-item {
        padding: 10px 8px;
        font-size: 12px;
    }

    .content-area {
        padding: 20px 15px;
    }

    .topbar {
        padding: 0 15px;
    }
}

/* =====================================================
   20. MOBILE
===================================================== */
@media (max-width: 650px) {

    html,
    body {
        width: 100%;
        min-width: 0;
        overflow-x: hidden;
    }

    body {
        font-size: 14px;
    }

    /* Main layout */
    .app-layout {
        display: flex;
        flex-direction: column;
        width: 100%;
        min-height: 100vh;
        padding-bottom: calc(76px + env(safe-area-inset-bottom));
    }

    .main-content {
        width: 100%;
        min-width: 0;
        flex: 1;
    }

    /* Compact brand header */
    .sidebar {
        position: relative;
        z-index: 10;

        display: flex;
        flex-direction: row;
        align-items: center;

        width: 100%;
        min-height: 62px;
        height: auto;

        padding: 10px 16px;
    }

    .brand {
        margin: 0;
        gap: 10px;
    }

    .brand-icon {
        width: 38px;
        height: 38px;
        border-radius: 10px;
        font-size: 20px;
    }

    .brand strong {
        font-size: 14px;
    }

    .brand small {
        font-size: 8px;
    }

    /* Hide desktop navigation */
    .sidebar-nav,
    .sidebar .nav-label,
    .sidebar-bottom {
        display: none !important;
    }

    /* Topbar */
    .topbar {
        min-height: 52px;
        padding: 0 16px;
        gap: 8px;
    }

    .topbar-title {
        font-size: 14px;
    }

    .topbar-right {
        font-size: 10px;
    }

    /* Content */
    .content-area {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 20px 14px;
    }

    .welcome-row {
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 20px;
    }

    h1 {
        font-size: 21px;
        line-height: 1.3;
    }

    h2 {
        font-size: 17px;
    }

    .welcome-row p,
    .section-heading p {
        margin-top: 5px;
        font-size: 12px;
    }

    .date-chip {
        padding: 8px 9px;
        font-size: 10px;
    }

    /* Statistics */
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-bottom: 28px;
    }

    .stat-card {
        min-width: 0;
        padding: 14px 12px;
    }

    .stat-card span,
    .stat-card small {
        font-size: 11px;
    }

    .stat-card strong {
        margin: 10px 0 5px;
        font-size: 25px;
    }

    /* Module cards */
    .modules-grid {
        grid-template-columns: 1fr;
        gap: 11px;
    }

    .module-card {
        min-height: auto;
        padding: 16px;
    }

    .module-icon {
        margin-bottom: 8px;
        font-size: 22px;
    }

    .module-card h3 {
        margin: 7px 0;
        font-size: 14px;
    }

    .module-card p {
        min-height: 0;
        margin: 5px 0 10px;
        font-size: 12px;
    }

    /* Touch-friendly form controls */
    input,
    select,
    textarea {
        min-height: 46px;
        font-size: 16px;
    }

    .form-group {
        margin-bottom: 14px;
    }

    .btn-primary,
    .btn-secondary,
    .btn-danger {
        min-height: 46px;
        padding: 11px 14px;
    }

    /* Tables: contained horizontal scroll until card views
       are implemented in individual modules */
    .table-wrapper {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 650px;
    }

    /* Fixed mobile bottom navigation */
    .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9999;

        display: grid !important;
        grid-template-columns: repeat(5, minmax(0, 1fr));

        width: 100%;
        min-height: calc(66px + env(safe-area-inset-bottom));

        padding: 7px 3px calc(7px + env(safe-area-inset-bottom));

        background: #fff;
        border-top: 1px solid var(--border);
        box-shadow: 0 -4px 16px rgba(30, 55, 42, .08);
    }

    .mobile-bottom-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;

        min-width: 0;
        color: var(--muted);
        font-size: 10px;
        white-space: nowrap;
    }

    .mobile-bottom-nav a.active {
        color: var(--green);
        font-weight: 700;
    }

    .mobile-bottom-nav .mobile-nav-icon {
        font-size: 20px;
        line-height: 22px;
    }

    /* Footer */
    .footer {
        padding: 15px;
        font-size: 10px;
    }

    .footer span {
        display: block;
        float: none;
        margin-top: 5px;
    }
}

/* =====================================================
   21. VERY SMALL MOBILE
===================================================== */
@media (max-width: 380px) {

    .content-area {
        padding-right: 11px;
        padding-left: 11px;
    }

    .stats-grid {
        gap: 8px;
    }

    .stat-card {
        padding: 12px 9px;
    }

    .stat-card strong {
        font-size: 22px;
    }

    .date-chip {
        padding: 7px;
        font-size: 9px;
    }

    .mobile-bottom-nav a {
        font-size: 9px;
    }

    .mobile-bottom-nav .mobile-nav-icon {
        font-size: 18px;
    }
}

/* =====================================================
   22. ACCESSIBILITY & MOTION
===================================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
