/* =====================================================
   NEXUS POS — App Stylesheet
   Tailwind ile birlikte kullanılır
   ===================================================== */

/* Alpine.js x-cloak — Alpine başlamadan gizle */
[x-cloak] { display: none !important; }

/* CSS Variables */
:root {
    --color-primary:  99 102 241;
    --color-accent:  245 158  11;
    --color-success:  34 197  94;
    --color-warning: 234 179   8;
    --color-error:   239  68  68;

    --bg-base:    248 250 252;
    --bg-surface: 255 255 255;
    --bg-subtle:  241 245 249;

    --text-primary:  15  23  42;
    --text-muted:   100 116 139;
    --border-color: 226 232 240;

    --radius: 0.5rem;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / .1);
}

[data-theme="dark"] {
    --bg-base:      15  23  42;
    --bg-surface:   30  41  59;
    --bg-subtle:    51  65  85;
    --text-primary: 241 245 249;
    --text-muted:   148 163 184;
    --border-color:  51  65  85;
}

/* =====================================================
   BASE
   ===================================================== */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'DM Sans', sans-serif;
    background-color: rgb(var(--bg-base));
    color: rgb(var(--text-primary));
    -webkit-font-smoothing: antialiased;
}

/* =====================================================
   TYPOGRAPHY
   ===================================================== */
.font-display { font-family: 'Bricolage Grotesque', sans-serif; }
.font-mono    { font-family: 'JetBrains Mono', monospace; }

/* =====================================================
   SCROLLBAR
   ===================================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgb(var(--border-color)); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgb(var(--text-muted)); }

/* =====================================================
   FORMS
   ===================================================== */
.form-input,
.form-select,
.form-textarea {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: rgb(var(--text-primary));
    background-color: rgb(var(--bg-surface));
    border: 1px solid rgb(var(--border-color));
    border-radius: var(--radius);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    appearance: none;
    -webkit-appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: rgb(var(--color-primary));
    box-shadow: 0 0 0 3px rgb(var(--color-primary) / 0.1);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
    border-color: rgb(var(--color-error));
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgb(var(--text-primary));
    margin-bottom: 0.375rem;
}

.form-error {
    font-size: 0.75rem;
    color: rgb(var(--color-error));
    margin-top: 0.25rem;
}

.form-hint {
    font-size: 0.75rem;
    color: rgb(var(--text-muted));
    margin-top: 0.25rem;
}

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    min-height: 2.25rem;
}

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

.btn-primary {
    background-color: rgb(var(--color-primary));
    color: #fff;
    border-color: rgb(var(--color-primary));
}
.btn-primary:hover { background-color: rgb(var(--color-primary) / 0.9); }

.btn-secondary {
    background-color: rgb(var(--bg-subtle));
    color: rgb(var(--text-primary));
    border-color: rgb(var(--border-color));
}
.btn-secondary:hover { background-color: rgb(var(--border-color)); }

.btn-danger {
    background-color: rgb(var(--color-error));
    color: #fff;
    border-color: rgb(var(--color-error));
}
.btn-danger:hover { background-color: rgb(var(--color-error) / 0.9); }

.btn-success {
    background-color: rgb(var(--color-success));
    color: #fff;
    border-color: rgb(var(--color-success));
}
.btn-success:hover { background-color: rgb(var(--color-success) / 0.9); }

.btn-ghost {
    background-color: transparent;
    color: rgb(var(--text-muted));
    border-color: transparent;
}
.btn-ghost:hover {
    background-color: rgb(var(--bg-subtle));
    color: rgb(var(--text-primary));
}

.btn-sm { padding: 0.25rem 0.625rem; font-size: 0.8125rem; min-height: 1.875rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; min-height: 2.75rem; }
.btn-xl { padding: 0.875rem 2rem; font-size: 1.0625rem; min-height: 3rem; }

/* Min 44px touch target for mobile */
@media (max-width: 1024px) {
    .btn { min-height: 2.75rem; }
}

/* =====================================================
   CARDS
   ===================================================== */
.card {
    background-color: rgb(var(--bg-surface));
    border: 1px solid rgb(var(--border-color));
    border-radius: calc(var(--radius) * 1.5);
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgb(var(--border-color));
}

.card-body { padding: 1.25rem; }

.card-title {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: rgb(var(--text-primary));
}

/* =====================================================
   TABLE
   ===================================================== */
.table-wrapper { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgb(var(--text-muted));
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: rgb(var(--bg-subtle));
    border-bottom: 1px solid rgb(var(--border-color));
    white-space: nowrap;
}

.table td {
    padding: 0.875rem 1rem;
    color: rgb(var(--text-primary));
    border-bottom: 1px solid rgb(var(--border-color));
    vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background-color: rgb(var(--bg-subtle) / 0.5); }

/* =====================================================
   BADGES
   ===================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 999px;
    white-space: nowrap;
}

/* =====================================================
   POS PRODUCT CARDS
   ===================================================== */
.product-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    border-radius: calc(var(--radius) * 1.5);
    border: 2px solid rgb(var(--border-color));
    background: rgb(var(--bg-surface));
    transition: all 0.15s ease;
    overflow: hidden;
    user-select: none;
}

.product-card:hover {
    border-color: rgb(var(--color-primary));
    box-shadow: 0 0 0 3px rgb(var(--color-primary) / 0.1);
    transform: translateY(-1px);
}

.product-card:active { transform: scale(0.97); }

.product-card.size-small  { width: 6rem; min-height: 7rem; }
.product-card.size-medium { width: 8rem; min-height: 9rem; }
.product-card.size-large  { width: 11rem; min-height: 12rem; }

/* =====================================================
   TABLE MAP (Restoran masa haritası)
   ===================================================== */
.table-map {
    position: relative;
    background-color: rgb(var(--bg-subtle));
    border: 1px solid rgb(var(--border-color));
    border-radius: calc(var(--radius) * 2);
    overflow: hidden;
}

.table-card {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid;
    font-weight: 600;
    font-size: 0.8125rem;
    transition: all 0.15s ease;
    user-select: none;
}

.table-card:hover { transform: scale(1.05); z-index: 10; }

.table-card.shape-square    { border-radius: 0.5rem; }
.table-card.shape-circle    { border-radius: 50%; }
.table-card.shape-rectangle { border-radius: 0.5rem; }

.table-card.size-small  { width: 80px; height: 80px; font-size: 0.75rem; }
.table-card.size-medium { width: 110px; height: 110px; }
.table-card.size-large  { width: 140px; height: 140px; font-size: 0.875rem; }

.table-card.status-empty    { background: rgb(34 197 94 / 0.1); border-color: rgb(34 197 94); color: rgb(21 128 61); }
.table-card.status-occupied { background: rgb(239 68 68 / 0.1); border-color: rgb(239 68 68); color: rgb(185 28 28); }
.table-card.status-reserved { background: rgb(234 179 8 / 0.1); border-color: rgb(234 179 8); color: rgb(133 77 14); }
.table-card.status-cleaning { background: rgb(59 130 246 / 0.1); border-color: rgb(59 130 246); color: rgb(29 78 216); }

/* =====================================================
   KITCHEN BOARD
   ===================================================== */
.kitchen-col {
    min-width: 280px;
    max-width: 320px;
    background: rgb(var(--bg-surface));
    border: 1px solid rgb(var(--border-color));
    border-radius: calc(var(--radius) * 1.5);
}

.kitchen-ticket {
    border-radius: var(--radius);
    border-left: 4px solid;
    transition: all 0.2s;
}

.kitchen-ticket.status-pending   { border-left-color: rgb(var(--color-warning)); }
.kitchen-ticket.status-preparing { border-left-color: rgb(var(--color-accent)); }
.kitchen-ticket.status-ready     { border-left-color: rgb(var(--color-success)); }

/* =====================================================
   PRINT
   ===================================================== */
@media print {
    .no-print, nav, header, aside, footer,
    #main-sidebar, #mobile-sidebar,
    .fixed.bottom-0 { display: none !important; }

    body { background: #fff; color: #000; }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}

/* =====================================================
   ANIMATIONS
   ===================================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

.animate-fade-in { animation: fadeIn 0.2s ease; }

/* Live indicator */
.live-dot {
    width: 8px; height: 8px;
    background: rgb(var(--color-success));
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

/* =====================================================
   SAFE AREA (PWA)
   ===================================================== */
.safe-area-bottom { padding-bottom: env(safe-area-inset-bottom, 0); }

/* Mobil içerik alanı alt boşluğu: bottom nav (64px) + iPhone home indicator */
.pb-nav-safe { padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px)); }

/* =====================================================
   DATATABLES — Klasik jquery.dataTables.min.js uyumlu stiller
   ===================================================== */
.dataTables_wrapper {
    font-size: 0.875rem;
    color: rgb(var(--text-primary));
}

/* Üst bar: length + filter */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.dataTables_wrapper .dataTables_length { float: left; }
.dataTables_wrapper .dataTables_filter { float: right; }
.dataTables_wrapper .dataTables_filter input {
    margin-left: 0.5rem;
    padding: 0.375rem 0.625rem;
    border: 1px solid rgb(var(--border-color));
    border-radius: var(--radius);
    background-color: rgb(var(--bg-surface));
    color: rgb(var(--text-primary));
    font-size: 0.8125rem;
    outline: none;
    transition: border-color 0.15s;
}
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: rgb(var(--color-primary));
    box-shadow: 0 0 0 3px rgb(var(--color-primary) / 0.1);
}
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
    color: rgb(var(--text-muted));
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin: 0;
}
.dataTables_wrapper .dataTables_length select {
    padding: 0.25rem 1.5rem 0.25rem 0.5rem;
    border: 1px solid rgb(var(--border-color));
    border-radius: var(--radius);
    background-color: rgb(var(--bg-surface));
    color: rgb(var(--text-primary));
    font-size: 0.8125rem;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.25rem center;
    background-size: 1.25rem;
}
.dataTables_wrapper .dataTables_length select:focus {
    border-color: rgb(var(--color-primary));
    box-shadow: 0 0 0 3px rgb(var(--color-primary) / 0.1);
}

/* Alt bar: info + paginate */
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    padding: 0.75rem 1rem;
}
.dataTables_wrapper .dataTables_info {
    float: left;
    color: rgb(var(--text-muted));
    font-size: 0.8125rem;
    padding-top: 0.875rem;
}
.dataTables_wrapper .dataTables_paginate {
    float: right;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Sayfalama butonları */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border-radius: var(--radius);
    border: 1px solid rgb(var(--border-color));
    background-color: rgb(var(--bg-surface));
    color: rgb(var(--text-primary));
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.disabled):not(.current) {
    background-color: rgb(var(--bg-subtle));
    border-color: rgb(var(--color-primary) / 0.4);
    color: rgb(var(--color-primary));
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background-color: rgb(var(--color-primary));
    border-color: rgb(var(--color-primary));
    color: #fff;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    opacity: 0.35;
    cursor: not-allowed;
    background-color: rgb(var(--bg-surface));
    color: rgb(var(--text-muted));
}

/* Üst/alt barlar arasındaki clearfix */
.dataTables_wrapper::after {
    content: '';
    display: table;
    clear: both;
}
.dataTables_wrapper .dataTables_length + .dataTables_filter::after,
.dataTables_wrapper .dataTables_info + .dataTables_paginate::after {
    content: '';
    display: table;
    clear: both;
}

/* Üst ve alt bölümlerin wrapper'ları için border */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    border-bottom: 1px solid rgb(var(--border-color));
    background-color: rgb(var(--bg-subtle) / 0.5);
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    border-top: 1px solid rgb(var(--border-color));
    background-color: rgb(var(--bg-subtle) / 0.5);
}

/* Sıralama ikonları */
.dataTables_wrapper table.dataTable thead th {
    cursor: pointer;
    position: relative;
    padding-right: 1.5rem;
}
.dataTables_wrapper table.dataTable thead th::after {
    content: '↕';
    position: absolute;
    right: 0.5rem;
    color: rgb(var(--text-muted) / 0.5);
    font-size: 0.75rem;
}
.dataTables_wrapper table.dataTable thead th.sorting_asc::after  { content: '↑'; color: rgb(var(--color-primary)); }
.dataTables_wrapper table.dataTable thead th.sorting_desc::after { content: '↓'; color: rgb(var(--color-primary)); }
.dataTables_wrapper table.dataTable thead th.sorting_disabled { cursor: default; padding-right: 1rem; }
.dataTables_wrapper table.dataTable thead th.sorting_disabled::after { display: none; }

/* DataTables kendi search/length'ini üst bölümde gösterince card içinde sığması */
.dataTables_wrapper table.dataTable { width: 100% !important; }

/* Seçili satır */
.dataTables_wrapper table.dataTable tbody tr.selected td {
    background-color: rgb(var(--color-primary) / 0.06);
}
