/* CateringPro - RTL Hebrew Catering Application */
/* גיליון סגנון - אפליקציית קייטרינג */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0891b2;
    --info-light: #cffafe;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    direction: rtl;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
}

/* Navbar */
.navbar {
    background: var(--primary);
    color: var(--white);
    padding: 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-client {
    background: var(--gray-800);
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    gap: 1rem;
}

.navbar-brand {
    color: var(--white);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
}

.navbar-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.navbar-links a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: background 0.2s;
}

.navbar-links a:hover {
    background: rgba(255,255,255,0.15);
    color: var(--white);
}

.navbar-user {
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    padding: 0 0.5rem;
}

.navbar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* Main content */
.main-content {
    flex: 1;
    padding: 1.5rem 1rem;
}

/* Footer */
.footer {
    background: var(--gray-800);
    color: var(--gray-400);
    text-align: center;
    padding: 1rem;
    font-size: 0.85rem;
    margin-top: auto;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1rem 1.25rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 0.75rem 1.25rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
}

/* Stats cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.stat-card .stat-label {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.danger .stat-value { color: var(--danger); }
.stat-card.info .stat-value { color: var(--info); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
}

.btn:hover { opacity: 0.9; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: var(--white); }
.btn-warning { background: var(--warning); color: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-info { background: var(--info); color: var(--white); }
.btn-secondary { background: var(--secondary); color: var(--white); }

.btn-outline {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.5);
    color: var(--white);
}
.btn-outline:hover { background: rgba(255,255,255,0.1); }

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

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 2rem; font-size: 1.1rem; }
.btn-block { width: 100%; }

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: var(--gray-700);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    direction: rtl;
    background: var(--white);
}

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

.form-control::placeholder {
    color: var(--gray-400);
}

select.form-control {
    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='%23475569' 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: left 0.7rem center;
    background-size: 1rem;
    padding-left: 2.5rem;
}

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

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
}

.form-text {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

.table th,
.table td {
    padding: 0.7rem 0.8rem;
    text-align: right;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.85rem;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table .actions {
    display: flex;
    gap: 0.3rem;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-secondary { background: var(--gray-200); color: var(--gray-600); }

/* Tag / allergy badges */
.tag {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
    margin: 0 0.1rem;
}

.tag-vegetarian { background: #dcfce7; color: #166534; }
.tag-gluten-free { background: #fef3c7; color: #92400e; }
.tag-spicy { background: #fee2e2; color: #991b1b; }
.tag-nuts { background: #fce7f3; color: #9d174d; }
.tag-dairy { background: #dbeafe; color: #1e40af; }
.tag-pareve { background: #e0e7ff; color: #3730a3; }
.badge-tag { background: var(--gray-200); color: var(--gray-700); }

/* Alerts */
.alert {
    padding: 0.8rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
}

.alert-success { background: var(--success-light); color: #166534; border: 1px solid #bbf7d0; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }
.alert-danger { background: var(--danger-light); color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: var(--info-light); color: #155e75; border: 1px solid #a5f3fc; }

.alert-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.6;
    padding: 0 0.3rem;
}

.alert-close:hover { opacity: 1; }

/* Login page */
.login-container {
    max-width: 420px;
    margin: 3rem auto;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
}

.login-title {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    color: var(--gray-800);
}

.login-logo {
    text-align: center;
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

/* Menu grid */
.menu-week {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.menu-day {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.menu-day-header {
    background: var(--primary);
    color: var(--white);
    padding: 0.6rem;
    text-align: center;
    font-weight: 600;
}

.menu-day-body {
    padding: 0.75rem;
}

.menu-category {
    margin-bottom: 0.75rem;
}

.menu-category-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.2rem;
}

.menu-item {
    font-size: 0.85rem;
    color: var(--gray-700);
    padding: 0.15rem 0;
}

/* Order form */
.order-day-section {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.order-day-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-light);
}

.order-category {
    margin-bottom: 0.75rem;
}

.order-category-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-600);
    margin-bottom: 0.3rem;
}

.order-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 4px;
    transition: background 0.15s;
}

.order-item:hover {
    background: var(--gray-50);
}

.order-item input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--primary);
}

.order-item label {
    cursor: pointer;
    flex: 1;
    font-size: 0.9rem;
}

.order-item .quantity-input {
    width: 60px;
    padding: 0.2rem 0.4rem;
    text-align: center;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 0.85rem;
}

/* Formula selector cards */
.formula-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.formula-card {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.formula-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.formula-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.2);
}

.formula-card .formula-name {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

.formula-card .formula-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
}

.formula-card .formula-desc {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 0.3rem;
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
}

.page-subtitle {
    font-size: 0.9rem;
    color: var(--gray-500);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.3rem;
    margin-top: 1.5rem;
    list-style: none;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.2rem;
    height: 2.2rem;
    padding: 0 0.5rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.9rem;
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
    transition: all 0.2s;
}

.pagination a:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

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

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

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

.modal {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--gray-400);
    padding: 0.2rem;
}

.modal-close:hover { color: var(--gray-700); }

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-start;
    gap: 0.5rem;
}

/* QR code modal */
.qr-container {
    text-align: center;
    padding: 1rem;
}

.qr-container img {
    max-width: 200px;
    margin: 1rem auto;
}

.qr-info {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-top: 0.5rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-500);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state-text {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* Invoice / print styles */
.invoice-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.invoice-title {
    font-size: 1.8rem;
    font-weight: 700;
}

.invoice-details {
    font-size: 0.9rem;
    line-height: 1.8;
}

.invoice-total {
    font-size: 1.3rem;
    font-weight: 700;
}

.signature-line {
    border-top: 1px solid var(--gray-400);
    width: 200px;
    margin-top: 3rem;
    padding-top: 0.5rem;
    text-align: center;
    color: var(--gray-500);
    font-size: 0.85rem;
}

/* Delivery note print */
.delivery-note {
    page-break-before: always;
}

.delivery-note:first-child {
    page-break-before: auto;
}

/* Kitchen print */
.kitchen-qty {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* Subscription / auto-order */
.day-chips {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.day-chip {
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 1.5rem;
    gap: 0;
}

.tab {
    padding: 0.7rem 1.2rem;
    text-decoration: none;
    color: var(--gray-500);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

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

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
    .navbar-links {
        display: none;
        position: absolute;
        top: 56px;
        right: 0;
        left: 0;
        background: inherit;
        flex-direction: column;
        padding: 0.5rem;
        box-shadow: var(--shadow-md);
        z-index: 200;
    }

    .navbar-links.open {
        display: flex;
    }

    .navbar-toggle {
        display: block;
    }

    .menu-week {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

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

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

    .page-header .btn-group {
        width: 100%;
        flex-wrap: wrap;
    }

    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    .table .actions {
        white-space: nowrap;
    }

    /* Formula grid mobile */
    .formula-grid {
        grid-template-columns: 1fr;
    }

    .formula-card {
        padding: 0.8rem;
    }

    /* Tabs scrollable on mobile */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        gap: 0;
    }

    .tab {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }

    /* Card adjustments */
    .card-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .card-body {
        padding: 0.8rem;
    }

    /* Modal full width on mobile */
    .modal {
        width: 95%;
        max-width: 95%;
        max-height: 90vh;
    }

    /* Button group wrapping */
    .btn-group {
        flex-wrap: wrap;
    }

    .btn-lg {
        width: 100%;
        text-align: center;
    }

    /* Filter forms stack on mobile */
    .card-body form[style*="display:flex"] {
        flex-direction: column;
    }

    /* Item rows in menu editor */
    .item-row {
        flex-direction: column !important;
    }

    .item-row > div {
        min-width: 100% !important;
        flex: auto !important;
    }

    /* QR container */
    .qr-container img {
        max-width: 150px;
    }

    /* Main content padding */
    .main-content {
        padding: 0.5rem 0;
    }

    .container {
        padding: 0 0.5rem;
    }

    /* Pagination */
    .pagination {
        flex-wrap: wrap;
    }

    .pagination a {
        min-width: 36px;
        height: 36px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .login-container {
        margin: 0.5rem auto;
        padding: 0 0.5rem;
    }

    .login-card {
        padding: 1.2rem;
    }

    .page-title {
        font-size: 1.3rem;
    }

    .table th,
    .table td {
        padding: 0.35rem 0.4rem;
        font-size: 0.75rem;
    }

    .btn-sm {
        padding: 0.2rem 0.5rem;
        font-size: 0.75rem;
    }

    .badge {
        font-size: 0.65rem;
        padding: 0.15rem 0.35rem;
    }

    /* Stack form controls */
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Order summary fixed at bottom */
    .order-summary-fixed {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--white);
        padding: 0.8rem 1rem;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
        z-index: 50;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* Hide less important columns on very small screens */
    .table .hide-mobile {
        display: none;
    }
}

/* Print styles */
@media print {
    .navbar, .footer, .btn, .navbar-toggle, .no-print, .tabs, .alert {
        display: none !important;
    }

    .main-content {
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid var(--gray-300);
        margin-bottom: 0.5rem;
    }

    .container {
        max-width: 100%;
    }

    body {
        font-size: 11pt;
    }

    .delivery-note {
        page-break-before: always;
    }

    .delivery-note:first-child {
        page-break-before: auto;
    }

    .kitchen-qty {
        color: #000;
    }
}
