@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
    --primary: #db9d33;
    /* Gold */
    --primary-hover: #c58b2a;
    --primary-light: #fef3c7;
    /* light gold */

    --bg-color: #f8fafc;
    --surface: #ffffff;

    --text-main: #1e293b;
    /* Dark slate */
    --text-muted: #64748b;
    /* Slate 500 */
    --text-light: #94a3b8;
    /* Slate 400 */

    --border: #e2e8f0;

    /* Status Colors */
    --status-pending-bg: #fed7aa;
    --status-pending-text: #c2410c;

    --status-partial-bg: #bae6fd;
    --status-partial-text: #0369a1;

    --status-delivered-bg: #bbf7d0;
    --status-delivered-text: #15803d;

    --font-family: "Inter", sans-serif;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 20px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

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

button,
input,
select,
textarea {
    font-family: inherit;
    outline: none;
    border: none;
}

button {
    cursor: pointer;
}

/* Header */
.top-header {
    background-color: #1e293b;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    border-bottom: 1px solid #334155;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background-image: url("../images/logo.svg");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transform: rotate(30deg);
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    background: #f1f5f9;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
}

.user-profile img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

/* Desktop Nav */
.desktop-nav {
    display: flex;
    gap: 32px;
    align-items: center;
}

.desktop-nav-item {
    font-size: 15px;
    font-weight: 600;
    color: #cbd5e1;
    transition: color 0.2s;
    padding: 24px 0;
    position: relative;
}

.desktop-nav-item:hover {
    color: var(--primary);
}

.desktop-nav-item.active {
    color: var(--primary);
}

.desktop-nav-item.active::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--primary);
    border-radius: 3px 3px 0 0;
}

/* Mobile Bottom Nav */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #1e293b;
    border-top: 1px solid #334155;
    justify-content: space-around;
    padding: 12px 0;
    padding-bottom: env(safe-area-inset-bottom, 20px);
    z-index: 50;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 500;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* Main Layout */
.main-container {
    padding: 50px;
    max-width: 1900px;
    margin: 0 auto;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}

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

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

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    background-color: #f1f5f9;
}

/* Auth Pages */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo svg {
    width: 40px;
    height: 40px;
    margin-bottom: 10px;
}

.auth-logo h1 {
    font-size: 24px;
    color: var(--text-main);
    margin-bottom: 4px;
}

.auth-logo p {
    color: var(--text-muted);
    font-size: 14px;
}

.auth-card {
    background: var(--surface);
    padding: 40px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 400px;
}

.auth-title {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--text-main);
}

.auth-title::after {
    content: "";
    display: block;
    width: 30px;
    height: 2px;
    background: var(--border);
    margin: 15px auto 0;
}

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

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.form-control-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.form-control-icon {
    position: absolute;
    left: 14px;
    color: var(--text-light);
    width: 20px;
    height: 20px;
}

.form-control-action {
    position: absolute;
    right: 14px;
    color: var(--text-light);
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
}

.form-control {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 15px;
    transition: all 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.forgot-password {
    display: block;
    text-align: right;
    font-size: 13px;
    color: var(--primary);
    font-weight: 500;
    margin-top: -10px;
    margin-bottom: 24px;
}

.btn-block {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    border-radius: var(--radius-md);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Page Header */
.page-header {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header-text {
    flex: 1;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

/* Mobile Dashboard View */
.mobile-dashboard-view {
    display: none;
}

.mobile-dashboard-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mobile-dashboard-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.mobile-dashboard-card.active {
    border: 2px solid var(--primary);
}

.mobile-dashboard-card .card-icon {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 20px;
    height: 20px;
}

.mobile-dashboard-card .card-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.mobile-dashboard-card .card-label {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Dashboard Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: var(--surface);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.summary-card-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 12px;
}

.summary-card-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.summary-card-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

.summary-card.active {
    border: 1px solid var(--primary);
}

.summary-card.active .summary-card-value {
    color: var(--primary);
}

.summary-card.active .summary-card-icon {
    color: var(--primary);
}

.summary-card-icon.orange {
    color: var(--primary);
}

.summary-card-icon.blue {
    color: #3b82f6;
}

.summary-card-icon.green {
    color: #10b981;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 16px;
}

.filter-tabs {
    display: flex;
    background: var(--surface);
    padding: 4px;
    border-radius: 30px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.filter-tab {
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tab.active {
    background: var(--primary);
    color: white;
}

.filter-actions {
    display: flex;
    gap: 12px;
}

.search-input-wrapper {
    position: relative;
    width: 300px;
}

.search-input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--surface);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    width: 18px;
    height: 18px;
}

/* Table */
.table-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th {
    padding: 16px 20px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-main);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.order-id {
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
}

.order-id-indicator {
    width: 4px;
    height: 24px;
    background: #3b82f6;
    /* Default to blue */
    border-radius: 4px;
    margin-right: 12px;
}

.customer-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.customer-info svg {
    color: var(--text-muted);
    width: 16px;
    height: 16px;
}

.product-info {
    color: var(--text-muted);
    font-size: 13px;
}

.qty-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    background: #f1f5f9;
    color: var(--text-main);
    text-align: center;
    min-width: 50px;
}

.qty-badge.blue {
    background: #eff6ff;
    color: #3b82f6;
}

.qty-badge.orange {
    background: #fff7ed;
    color: var(--primary);
}

.status-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.status-partial {
    background: var(--status-partial-bg);
    color: var(--status-partial-text);
}

.status-pending {
    background: var(--status-pending-bg);
    color: var(--status-pending-text);
}

.status-delivered {
    background: var(--status-delivered-bg);
    color: var(--status-delivered-text);
}

.date-text {
    color: var(--text-muted);
    font-size: 13px;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    padding-bottom: 24px;
    list-style: none;
    padding-left: 0;
}

.pagination-info {
    font-size: 14px;
    color: var(--text-muted);
    margin-right: 16px;
}

.page-item {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: inherit;
    text-decoration: none;
    background: transparent;
}

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

.page-item:hover:not(.active):not(.disabled) {
    background: #f1f5f9;
}

.page-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile Orders List */
.mobile-orders-list,
.mobile-tokens-list {
    display: none;
    flex-direction: column;
    gap: 10px;
}

.mobile-order-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 12px;
}

.mobile-order-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}

.mobile-order-id {
    font-weight: 700;
    color: var(--text-main);
    font-size: 15px;
}

.mobile-order-date {
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
    white-space: nowrap;
}

.mobile-order-bottom {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.mobile-order-info-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 0;
    min-width: 0;
}

.mobile-order-name {
    font-weight: 700;
    color: var(--text-main);
    font-size: 15px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.mobile-order-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    font-size: 14px;
}

.mobile-order-actions-row {
    display: flex;
    gap: 14px;
    align-items: center;
    flex: 0 0 auto;
    margin-left: auto;
}

.mobile-order-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.mobile-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mobile-stat-label {
    font-size: 11px;
    color: var(--text-light);
    text-transform: uppercase;
    font-weight: 600;
}

.mobile-stat-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
}

.mobile-stat-value.blue {
    color: #3b82f6;
}

.mobile-stat-value.orange {
    color: var(--primary);
}

.mobile-order-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 12px;
}

/* Create Order Layout */
.create-order-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
}

.form-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 20px;
}

.order-summary-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 2px solid var(--primary);
    position: sticky;
    top: 24px;
}

.summary-row {
    margin-bottom: 20px;
}

.summary-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.summary-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
}

.summary-value.blue {
    color: #3b82f6;
}

.summary-value.orange {
    color: var(--primary);
}

.summary-divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

/* Custom Select */
.custom-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Order Item Row */
.order-item-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.order-item-col {
    flex: 1;
}

.order-item-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    text-align: center;
}

.order-item-input.left-align {
    text-align: left;
    padding-left: 36px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z'%3e%3c/path%3e%3cpolyline points='3.27 6.96 12 12.01 20.73 6.96'%3e%3c/polyline%3e%3cline x1='12' y1='22.08' x2='12' y2='12'%3e%3c/line%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: 12px center;
    background-size: 16px;
}

.add-product-btn {
    width: 100%;
    padding: 16px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-light);
    font-weight: 600;
    font-size: 14px;
    margin-top: 16px;
    transition: all 0.2s;
}

.add-product-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.trash-btn {
    color: var(--text-light);
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
}

.trash-btn:hover {
    color: #ef4444;
}

/* Textarea */
.form-textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    resize: vertical;
    min-height: 100px;
}

.link-text {
    color: #3b82f6;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-block;
    margin-top: 8px;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .create-order-layout {
        grid-template-columns: 1fr;
    }

    .order-summary-card {
        position: static;
    }
}

@media (max-width: 768px) {
    .top-header {
        justify-content: space-between;
        border-bottom: none;
        padding: 16px 20px;
        background: var(--bg-color);
        height: auto;
    }

    .top-header .user-profile {
        display: none;
        /* Hide profile on mobile header */
    }

    .top-header .logo-container {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        width: auto;
    }

    .top-header .logo-icon {
        width: 32px;
        height: 32px;
    }

    .top-header .logo-text,
    .desktop-header-subtitle {
        display: none !important;
    }

    .mobile-header-title {
        display: block !important;
        font-size: 20px;
        font-weight: 700;
        color: var(--text-main);
        margin: 0;
    }

    .bottom-nav {
        display: flex;
    }

    .desktop-nav {
        display: none;
    }

    .main-container {
        padding: 0px 20px 80px 20px;
    }

    .summary-cards {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input-wrapper {
        width: 100%;
    }

    .filter-tabs {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 4px;
        border: none;
        box-shadow: none;
        background: transparent;
        justify-content: space-between;
    }

    .filter-tab {
        padding: 6px 16px;
    }

    .filter-actions {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        align-items: center !important;
        width: 100% !important;
        margin-left: 0 !important;
    }

    .filter-actions form {
        flex: 1;
        min-width: 0 !important;
    }

    .search-input-wrapper {
        width: 100%;
    }

    .search-input {
        padding-left: 36px;
        padding-right: 12px;
    }

    .per-page-wrapper select {
        padding: 0 8px;
        width: auto;
    }

    .desktop-only {
        display: none !important;
    }

    .mobile-add-btn {
        padding: 10px !important;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-add-btn i {
        margin: 0 !important;
    }

    .mobile-add-btn .btn-text {
        display: none;
    }

    .table-container {
        -webkit-overflow-scrolling: touch;
    }

    .mobile-orders-list,
    .mobile-tokens-list {
        display: flex;
        /* Show mobile list */
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .mobile-page-title {
        display: block;
        text-align: center;
        font-size: 20px;
        font-weight: 700;
        margin-bottom: 20px;
    }

    .mobile-dashboard-view {
        display: block;
    }

    .desktop-dashboard-view {
        display: none;
    }
}

@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }

    .desktop-header-subtitle {
        display: none;
    }

    .mobile-page-title {
        display: none;
    }

    .mobile-dashboard-view {
        display: none;
    }

    .desktop-dashboard-view {
        display: block;
    }
}
