:root {
    --bg-main: #0a0b0e;
    --panel-bg: #111318;
    --panel-bg-right: #12151b;
    --card-bg: #1c1f26;
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --text-tertiary: #6b7280;
    --accent-color: #f1f5f9;
    --primary: #3b82f6;
    /* Blue primary like logotype */
    --primary-hover: #2563eb;
    --btn-border: rgba(255, 255, 255, 0.15);
    --btn-border-focus: #4ade80;
    /* Subtle green for focus */
    --input-bg: #272a33;
    --input-border: rgba(255, 255, 255, 0.05);
    --danger: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
}

/* App Layout Grid */
.app-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    background-color: #0d0f13;
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    z-index: 10;
}

.sidebar-logo-container {
    width: 100%;
    aspect-ratio: 1/1;
    margin-bottom: 2.5rem;
    border-radius: 16px;
    overflow: hidden;
    background-color: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--card-border);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.sidebar-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 1rem 1.5rem;
    text-align: left;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-btn.active {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 15px -3px rgba(59, 130, 246, 0.3);
}

.nav-btn i {
    width: 20px;
    text-align: center;
}

/* Main Area & Tabs */
.content-area {
    padding: 2rem;
    height: 100vh;
    overflow-y: auto;
    position: relative;
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease-out;
    height: 100%;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dashboard Grid (Old layout, now inside tab) */
.dashboard {
    display: flex;
    gap: 1.5rem;
    width: 100%;
    max-width: 1400px;
    min-height: calc(100vh - 4rem);
}

/* Common Panel Styles */
.panel {
    border-radius: 16px;
    border: 1px solid var(--card-border);
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.panel-left {
    flex: 1;
    background-color: var(--panel-bg);
}

.panel-right {
    flex: 1;
    background-color: var(--panel-bg-right);
}

.panel-full {
    background-color: var(--panel-bg);
    min-height: calc(100vh - 4rem);
}

/* Order Info Forms (New) */
.order-info-card {
    background-color: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    gap: 1.5rem;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.form-group input {
    background-color: var(--bg-main);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 0.85rem 1rem;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Header Styles */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.panel-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-right: 1.5rem;
}

.header-actions {
    display: flex;
    align-items: center;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Add Button Container */
.add-container {
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
}

.btn-add-product {
    background-color: transparent;
    border: 1px dashed var(--btn-border);
    color: var(--text-secondary);
    width: 100%;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    border-radius: 12px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-add-product:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

/* Left Panel Elements */
.input-cards {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.input-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    position: relative;
    animation: fadeIn 0.3s ease-out;
}

.card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Input that looks like a title */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.4rem;
}

.name-input {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 700;
    font-family: inherit;
    padding: 0.2rem 0.5rem;
    margin-left: -0.5rem;
    border-radius: 6px;
    width: 100%;
    transition: all 0.2s;
}

.name-input:hover {
    background: rgba(255, 255, 255, 0.05);
}

.name-input:focus {
    background: var(--input-bg);
    border-color: rgba(255, 255, 255, 0.2);
    outline: none;
}

.btn-delete-card {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem;
    transition: color 0.2s;
}

.btn-delete-card:hover {
    color: var(--danger);
}

.card-fields {
    display: flex;
    gap: 1rem;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 110px;
}

.field-group label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

input[type="number"] {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
}

input[type="number"]:focus {
    border-color: rgba(255, 255, 255, 0.3);
}

/* Remove Arrows */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Actions */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.action-buttons-secondary {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}


.btn {
    padding: 0.8rem 1.25rem;
    border-radius: 24px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.btn-primary {
    background-color: var(--primary);
    border: 1px solid var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 15px -3px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--btn-border-focus);
    color: var(--text-primary);
}

.btn-outline:hover {
    background-color: rgba(74, 222, 128, 0.1);
}

.btn-dark {
    background-color: var(--card-bg);
    border: 1px solid var(--btn-border);
    color: var(--text-primary);
}

.btn-dark:hover {
    background-color: #272a33;
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.panel-footer p {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    line-height: 1.5;
}

/* Right Panel: Table */
.table-container {
    width: 100%;
    overflow-x: auto;
}

.full-height-table {
    flex: 1;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.preview-table th {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid var(--card-border);
}

.preview-table td {
    padding: 1.2rem 0;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.95rem;
    color: var(--accent-color);
}

/* Dynamic row styles */
.preview-table tbody tr {
    animation: fadeIn 0.3s ease-out;
}

.preview-table tbody tr td.col-item input {
    background: transparent;
    border: none;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    font-weight: 600;
    width: 100%;
    outline: none;
    pointer-events: none;
}

.preview-table tbody tr td.col-item {
    font-weight: 600;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.preview-table tfoot td {
    font-weight: 700;
    border-bottom: none;
    padding-top: 1.5rem;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.history-table td {
    padding: 1.5rem 1rem 1.5rem 0;
}

.history-table th {
    padding-right: 1rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-tertiary);
    border: 1px dashed var(--btn-border);
    border-radius: 12px;
}

/* Info button in table */
.btn-info {
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0.3rem;
    border-radius: 50%;
}

.btn-info:hover {
    color: var(--primary-hover);
    background-color: rgba(59, 130, 246, 0.1);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: var(--panel-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 1rem;
}

.modal-header h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    font-weight: 700;
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-close-modal:hover {
    color: var(--danger);
}

.modal-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 0;
    border-bottom: 1px dashed var(--card-border);
}

.modal-item-row:last-child {
    border-bottom: none;
}

.modal-item-name {
    font-weight: 600;
    color: var(--accent-color);
}

.modal-item-details {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: right;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: #10b981;
    color: white;
    padding: 1rem 2rem;
    border-radius: 30px;
    font-weight: 600;
    box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.4);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100;
    opacity: 0;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Responsiveness */
@media (max-width: 1024px) {
    .app-layout {
        grid-template-columns: 200px 1fr;
    }

    .dashboard {
        flex-direction: column;
        height: auto;
    }
}

@media (max-width: 768px) {
    .app-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .sidebar {
        flex-direction: row;
        padding: 1rem;
        border-right: none;
        border-bottom: 1px solid var(--card-border);
        align-items: center;
        justify-content: space-between;
    }

    .sidebar-logo-container {
        width: 50px;
        height: 50px;
        margin-bottom: 0;
    }

    .sidebar-nav {
        flex-direction: row;
    }

    .nav-btn {
        padding: 0.5rem 1rem;
    }

    .order-info-card {
        flex-direction: column;
    }

    .input-card {
        flex-direction: column;
        gap: 1.5rem;
    }

    .card-fields {
        width: 100%;
    }

    .field-group {
        flex: 1;
    }
}