@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap');
@import url('assets/ui-notify.css');

:root {
    --background: #fbfcfd;
    --foreground: #0f1724;
    --border: #00000014;
    --input: #ffffff;
    --primary: #ff7a18;
    --primary-foreground: #ffffff;
    --secondary: #f1f6f9;
    --secondary-foreground: #0f1724;
    --muted: #f7fafc;
    --muted-foreground: #9aa4ae;
    --success: #12b76a;
    --success-foreground: #ffffff;
    --accent: #ffd166;
    --accent-foreground: #0f1724;
    --destructive: #e02424;
    --destructive-foreground: #ffffff;
    --warning: #ffb020;
    --warning-foreground: #0f1724;
    --card: #ffffff;
    --card-foreground: #0f1724;
    --sidebar: #f8fafb;
    --sidebar-foreground: #24303a;
    --sidebar-primary: #ff7a18;
    --sidebar-primary-foreground: #ffffff;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --font-family-body: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family-body);
    background-color: var(--background);
    color: var(--foreground);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
    font-weight: 600;
    color: var(--foreground);
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.text-muted {
    color: var(--muted-foreground);
}

.text-destructive {
    color: var(--destructive);
}

.mt-12 {
    margin-top: 12px;
}

.mt-16 {
    margin-top: 16px;
}

.mt-24 {
    margin-top: 24px;
}

.mb-12 {
    margin-bottom: 12px;
}

.w-full {
    width: 100%;
}

.gap-8 {
    gap: 8px;
}

/* Layout */
.setup-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 72px;
    background-color: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5%;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background-color: var(--primary);
    color: var(--primary-foreground);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-steps {
    display: flex;
    align-items: center;
    gap: 20px;
}

.step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted-foreground);
}

.step.active {
    color: var(--foreground);
    font-weight: 600;
}

.step-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--muted);
    border: 1px solid var(--border);
    font-size: 12px;
}

.step.active .step-number {
    background-color: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

.step.completed {
    color: var(--foreground);
}

.step-number.completed {
    background-color: var(--success);
    color: var(--success-foreground);
    border-color: var(--success);
}

.step-text {
    display: none;
}

@media (min-width: 768px) {
    .header-steps {
        gap: 32px;
    }

    .step-text {
        display: inline;
    }
}

.setup-main {
    padding-top: 72px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.setup-container {
    max-width: 800px;
    width: 100%;
    margin: 24px auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

@media (min-width: 768px) {
    .setup-container {
        margin: 48px auto;
        gap: 32px;
    }
}

.page-header h1 {
    font-size: clamp(24px, 5vw, 28px);
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.page-header p {
    font-size: 15px;
}

/* Components */
.setup-card {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

@media (min-width: 768px) {
    .card-header {
        padding: 24px;
    }
}

.card-header h2 {
    font-size: 18px;
    margin-bottom: 4px;
}

.card-body {
    padding: 20px;
}

@media (min-width: 768px) {
    .card-body {
        padding: 24px;
    }
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr 1fr;
        gap: 24px;
    }
}

.full-width {
    grid-column: 1 / -1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--foreground);
}

.form-input {
    height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background-color: var(--background);
    padding: 0 12px;
    display: flex;
    align-items: center;
    font-size: 14px;
    color: var(--foreground);
    width: 100%;
    transition: border-color 0.2s;
}

.form-input:focus-within {
    border-color: var(--primary);
    outline: none;
}

.form-textarea {
    min-height: 100px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background-color: var(--background);
    padding: 12px;
    font-size: 14px;
    color: var(--foreground);
    display: flex;
    align-items: flex-start;
    width: 100%;
}

.text-placeholder {
    color: var(--muted-foreground);
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background-color: var(--muted);
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover {
    border-color: var(--primary);
    background-color: var(--secondary);
}

.upload-icon {
    width: 48px;
    height: 48px;
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-foreground);
}

.upload-text {
    font-weight: 500;
    color: var(--foreground);
    text-align: center;
}

.upload-hint {
    font-size: 13px;
    color: var(--muted-foreground);
}

.btn {
    height: 44px;
    padding: 0 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    border: none;
    white-space: nowrap;
    transition: transform 0.1s, opacity 0.2s;
}

.btn:active {
    transform: scale(0.98);
}

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

.btn-secondary {
    background-color: var(--muted);
    color: var(--foreground);
    border: 1px solid var(--border);
}

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

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: background 0.2s;
}

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

/* Specific components */
.area-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.area-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background-color: var(--background);
}

.area-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.area-icon {
    width: 40px;
    height: 40px;
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-foreground);
}

.area-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--foreground);
}

.area-meta {
    font-size: 13px;
    color: var(--muted-foreground);
    margin-top: 4px;
}

.printer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .printer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 24px;
    }
}

.printer-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    background-color: var(--background);
}

.printer-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.printer-icon {
    width: 32px;
    height: 32px;
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--foreground);
}

.printer-title {
    font-weight: 600;
    flex: 1;
    font-size: 15px;
}

.status-badge {
    padding: 4px 10px;
    border-radius: var(--radius-xl);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.status-ready {
    background-color: #d1fae5;
    color: #065f46;
}

.status-disconnected {
    background-color: #f3f4f6;
    color: #4b5563;
}

.switch {
    width: 40px;
    height: 22px;
    background-color: var(--border);
    border-radius: 20px;
    position: relative;
    display: flex;
    align-items: center;
    padding: 2px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.switch.active {
    background-color: var(--primary);
}

.switch-thumb {
    width: 18px;
    height: 18px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.switch.active .switch-thumb {
    transform: translateX(18px);
}

.setup-actions {
    display: flex;
    flex-direction: column-reverse;
    gap: 12px;
    padding: 24px 0;
    border-top: 1px solid var(--border);
}

@media (min-width: 480px) {
    .setup-actions {
        flex-direction: row;
        justify-content: flex-end;
        gap: 16px;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.modal-overlay.active {
    display: flex;
}

.modal-container {
    background-color: var(--card);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: modal-appear 0.3s ease-out;
    overflow: hidden;
}

.modal-container form {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

.modal-container .card-body {
    overflow-y: auto;
    flex: 1;
    max-height: calc(90vh - 130px);
}

@keyframes modal-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
    background-color: var(--card, #fff);
}

/* Image Preview Styles */
.image-preview-container {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    display: none;
    margin-bottom: 12px;
}

.image-preview-container.active {
    display: block;
}

.image-preview-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background-color: var(--destructive);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
}

.hidden {
    display: none !important;
}

/* Disabled section */
.disabled-section {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(0.5);
}

/* Master Unified Sidebar Component Styles */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    background-color: var(--sidebar, #f8fafb);
    border-right: 1px solid var(--border, #e4e4e7);
    display: flex;
    flex-direction: column;
    z-index: 40;
    transition: transform 0.3s ease;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-header {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border, #e4e4e7);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background-color: var(--primary, #ff7a18);
    color: var(--primary-foreground, #ffffff);
    border-radius: var(--radius-md, 6px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-nav {
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    flex: 1;
}

a.nav-item,
button.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md, 6px);
    font-size: 14px;
    font-weight: 500;
    color: var(--muted-foreground, #71717a);
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    text-decoration: none;
    font-family: inherit;
    transition: background-color 0.15s ease, color 0.15s ease;
}

a.nav-item:hover,
button.nav-item:hover {
    background-color: var(--muted, #f4f4f5);
    color: var(--foreground, #09090b);
}

a.nav-item.active,
button.nav-item.active {
    background-color: #ffffff;
    color: var(--primary, #ff7a18);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.nav-item-nested {
    padding-left: 20px;
    font-size: 13px;
}

.nav-item-logout {
    margin-top: auto;
    color: var(--destructive, #e02424) !important;
}

.nav-item-logout:hover {
    background-color: #fef2f2 !important;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted-foreground, #9aa4ae);
    margin: 16px 0 8px 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.nav-section-collapse {
    margin-top: 12px;
    padding: 0;
}

.nav-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    border: none !important;
    background: transparent !important;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted-foreground, #9aa4ae);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}


.nav-collapse-icon {
    transition: transform 0.2s ease;
    font-size: 16px;
}

.nav-collapse-icon.open {
    transform: rotate(180deg);
}

.nav-collapse-group[hidden] {
    display: none;
}

/* Mobile Sidebar Drawer Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99;
    display: none;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.open {
    display: block;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        z-index: 100;
    }
    .sidebar.open {
        transform: translateX(260px);
    }
}

/* --- Mobile Sticky Bottom Navigation Bar (≤768px) --- */
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 56px !important;
        background: #ffffff !important;
        border-top: 1px solid var(--border, #e4e4e7) !important;
        z-index: 1000 !important;
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08) !important;
        align-items: center !important;
        justify-content: space-around !important;
        padding: 0 4px !important;
        box-sizing: border-box !important;
    }

    .mobile-nav-item {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 2px !important;
        flex: 1 !important;
        height: 100% !important;
        color: var(--muted-foreground, #71717a) !important;
        text-decoration: none !important;
        font-size: 11px !important;
        font-weight: 500 !important;
        transition: color 0.15s ease !important;
    }

    .mobile-nav-item iconify-icon {
        font-size: 20px !important;
        transition: transform 0.15s ease !important;
    }

    .mobile-nav-item.active {
        color: var(--primary, #ff7a18) !important;
        font-weight: 700 !important;
    }

    .mobile-nav-item.active iconify-icon {
        transform: scale(1.1) !important;
        color: var(--primary, #ff7a18) !important;
    }

    /* Add bottom padding to content area so content isn't covered by bottom nav */
    body:not(.order-taking-page) .content-area {
        padding-bottom: 72px !important;
    }
}