/* --- GLOBAL STYLES --- */
:root {
    --bg-color: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.75);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #f97316;
    --accent-hover: #ea580c;
    --success: #22c55e;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --font-ui: 'Inter', sans-serif;
    --font-print: 'Space Mono', 'Courier New', monospace;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-ui);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(249, 115, 22, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(56, 189, 248, 0.1), transparent 25%);
}

/* --- UI LAYOUT (SCREEN ONLY) --- */
@media screen {
    .print-only {
        display: none !important;
    }

    .app-container {
        display: flex;
        flex-direction: column;
        height: 100vh;
        max-width: 1600px;
        margin: 0 auto;
        padding: 1.5rem;
        gap: 1.5rem;
    }

    /* HEADER */
    .app-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: var(--panel-bg);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        padding: 1rem 2rem;
        border-radius: 16px;
        border: 1px solid var(--border-color);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    }

    .logo-area {
        display: flex;
        align-items: center;
        gap: 12px;
        font-size: 1.5rem;
        font-weight: 800;
        color: var(--accent);
    }

    .logo-area span {
        color: var(--text-main);
        font-weight: 400;
    }

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

    .btn-admin {
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid var(--border-color);
        color: var(--text-main);
        padding: 8px 16px;
        border-radius: 8px;
        cursor: pointer;
        font-family: var(--font-ui);
        font-weight: 600;
        transition: all 0.2s;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .btn-admin:hover {
        background: rgba(255, 255, 255, 0.2);
        border-color: var(--accent);
        color: var(--accent);
    }

    .time-display {
        font-family: var(--font-print);
        font-size: 1.2rem;
        color: var(--text-muted);
        letter-spacing: 2px;
    }

    /* MAIN CONTENT */
    .main-content {
        display: grid;
        grid-template-columns: 1fr 400px;
        gap: 1.5rem;
        flex: 1;
        min-height: 0;
    }

    /* PRODUCTS SECTION */
    .products-section {
        display: flex;
        flex-direction: column;
        gap: 2rem;
        overflow-y: auto;
        padding-right: 0.5rem;
    }

    .products-section::-webkit-scrollbar { width: 8px; }
    .products-section::-webkit-scrollbar-track { background: transparent; }
    .products-section::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

    .category-block {
        display: flex;
        flex-direction: column;
        gap: 1.25rem;
    }

    .category-header {
        font-size: 1.3rem;
        font-weight: 800;
        color: var(--accent);
        text-transform: uppercase;
        letter-spacing: 1px;
        border-bottom: 2px solid rgba(255, 255, 255, 0.05);
        padding-bottom: 0.5rem;
    }

    .products-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1.25rem;
    }

    .product-card {
        background: var(--panel-bg);
        border: 1px solid var(--border-color);
        border-radius: 16px;
        padding: 1.5rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        cursor: pointer;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        backdrop-filter: blur(12px);
    }

    .product-card:hover {
        transform: translateY(-4px);
        border-color: var(--accent);
        box-shadow: 0 10px 15px -3px rgba(249, 115, 22, 0.2);
    }

    .product-icon {
        font-size: 3rem;
        color: var(--text-muted);
        transition: color 0.2s ease;
    }

    .product-card:hover .product-icon {
        color: var(--accent);
    }

    .product-info {
        text-align: center;
        width: 100%;
    }

    .product-name {
        font-weight: 600;
        font-size: 1.1rem;
        margin-bottom: 0.25rem;
    }

    .product-price {
        color: var(--accent);
        font-weight: 700;
        font-size: 1.25rem;
    }

    /* CART SECTION */
    .cart-section {
        display: flex;
        flex-direction: column;
    }

    .glass-panel {
        background: var(--panel-bg);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid var(--border-color);
        border-radius: 16px;
        padding: 1.5rem;
        display: flex;
        flex-direction: column;
        height: 100%;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    }

    .cart-items {
        flex: 1;
        overflow-y: auto;
        margin: 1.5rem 0;
        padding-right: 0.5rem;
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .cart-items::-webkit-scrollbar { width: 6px; }
    .cart-items::-webkit-scrollbar-track { background: transparent; }
    .cart-items::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

    .empty-cart-msg {
        text-align: center;
        color: var(--text-muted);
        margin: auto;
        font-style: italic;
    }

    .cart-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: rgba(0,0,0,0.2);
        padding: 1rem;
        border-radius: 12px;
        border: 1px solid rgba(255,255,255,0.05);
    }

    .item-details {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }

    .item-name {
        font-weight: 600;
    }

    .item-price {
        color: var(--text-muted);
        font-size: 0.9rem;
    }

    .item-controls {
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }

    .btn-qty {
        background: rgba(255,255,255,0.1);
        border: none;
        color: var(--text-main);
        width: 28px;
        height: 28px;
        border-radius: 6px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.2s;
    }

    .btn-qty:hover {
        background: rgba(255,255,255,0.2);
    }

    .btn-qty.decrease:hover { background: var(--danger); }
    .btn-qty.increase:hover { background: var(--success); }

    .item-qty-display {
        font-weight: 700;
        min-width: 20px;
        text-align: center;
    }

    .cart-summary {
        background: rgba(0,0,0,0.3);
        padding: 1.25rem;
        border-radius: 12px;
        margin-bottom: 1.5rem;
    }

    .summary-row {
        display: flex;
        justify-content: space-between;
        margin-bottom: 0.5rem;
        color: var(--text-muted);
    }

    .total-row {
        margin-top: 1rem;
        margin-bottom: 0;
        padding-top: 1rem;
        border-top: 1px solid var(--border-color);
        color: var(--accent);
        font-size: 1.5rem;
        font-weight: 800;
    }

    .customer-details {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .subsection-title {
        font-size: 1rem;
        font-weight: 600;
        color: var(--text-main);
        margin-bottom: 0.5rem;
    }

    /* Payment Method Selector */
    .payment-method-selector {
        display: flex;
        gap: 10px;
        margin-bottom: 1rem;
    }

    .payment-method-selector input[type="radio"] {
        display: none;
    }

    .pay-btn {
        flex: 1;
        background: rgba(0,0,0,0.3);
        border: 2px solid var(--border-color);
        color: var(--text-muted);
        padding: 10px;
        border-radius: 8px;
        text-align: center;
        font-weight: 700;
        cursor: pointer;
        transition: all 0.2s;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 8px;
    }

    .payment-method-selector input[type="radio"]:checked + .pay-btn {
        background: rgba(34, 197, 94, 0.2); /* success color bg */
        border-color: var(--success);
        color: var(--success);
    }

    .input-group {
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
    }

    .input-group label {
        font-size: 0.85rem;
        color: var(--text-muted);
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .input-group input, .input-group textarea {
        background: rgba(0,0,0,0.2);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 0.75rem 1rem;
        color: var(--text-main);
        font-family: var(--font-ui);
        font-size: 0.95rem;
        outline: none;
        transition: border-color 0.2s;
        resize: none;
    }

    .input-group input:focus, .input-group textarea:focus {
        border-color: var(--accent);
    }

    .btn-print {
        background: var(--accent);
        color: white;
        border: none;
        padding: 1.25rem;
        border-radius: 12px;
        font-size: 1.1rem;
        font-weight: 700;
        cursor: pointer;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 10px;
        transition: all 0.2s;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    .btn-print:hover:not(:disabled) {
        background: var(--accent-hover);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
    }

    .btn-print:disabled {
        background: #334155;
        color: #64748b;
        cursor: not-allowed;
    }

    /* --- ADMIN MODAL --- */
    .modal-overlay {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0, 0, 0, 0.8);
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 1000;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        backdrop-filter: blur(5px);
    }

    .modal-overlay.active {
        opacity: 1;
        pointer-events: all;
    }

    .modal-content {
        width: 90%;
        max-width: 1100px;
        max-height: 90vh;
        overflow-y: auto;
        position: relative;
        padding: 2rem;
        transform: translateY(20px);
        transition: transform 0.3s ease;
    }

    .modal-overlay.active .modal-content {
        transform: translateY(0);
    }

    .btn-close {
        position: absolute;
        top: 1.5rem;
        right: 1.5rem;
        background: none;
        border: none;
        color: var(--text-muted);
        font-size: 1.5rem;
        cursor: pointer;
        transition: color 0.2s;
    }

    .btn-close:hover {
        color: var(--danger);
    }

    .modal-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
        color: var(--accent);
    }

    .admin-tabs {
        display: flex;
        gap: 1rem;
        border-bottom: 1px solid var(--border-color);
        margin-bottom: 1.5rem;
    }

    .tab-btn {
        background: none;
        border: none;
        color: var(--text-muted);
        font-size: 1.1rem;
        font-weight: 600;
        padding: 0.5rem 1rem;
        cursor: pointer;
        border-bottom: 2px solid transparent;
        transition: all 0.2s;
    }

    .tab-btn:hover {
        color: var(--text-main);
    }

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

    .tab-content {
        display: none;
    }

    .tab-content.active {
        display: block;
    }

    .add-product-form, .report-controls {
        display: flex;
        gap: 1rem;
        margin-bottom: 1.5rem;
        align-items: center;
    }

    .add-product-form input, .report-controls input {
        background: rgba(0,0,0,0.3);
        border: 1px solid var(--border-color);
        color: white;
        padding: 0.75rem;
        border-radius: 8px;
        flex: 1;
        font-family: var(--font-ui);
    }

    .btn-primary {
        background: var(--accent);
        color: white;
        border: none;
        padding: 0.75rem 1.5rem;
        border-radius: 8px;
        font-weight: 600;
        cursor: pointer;
        transition: background 0.2s;
    }

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

    .btn-danger {
        background: rgba(239, 68, 68, 0.2);
        color: var(--danger);
        border: 1px solid var(--danger);
        padding: 0.4rem 0.8rem;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.2s;
    }
    
    .btn-danger:hover {
        background: var(--danger);
        color: white;
    }

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

    .admin-table th, .admin-table td {
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
    }

    .admin-table th {
        color: var(--text-muted);
        font-weight: 600;
        text-transform: uppercase;
        font-size: 0.85rem;
    }

    .table-container {
        background: rgba(0,0,0,0.2);
        border-radius: 12px;
        overflow: hidden;
    }

    .report-summary-cards {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .report-card {
        background: rgba(0,0,0,0.3);
        border: 1px solid var(--border-color);
        padding: 1.5rem;
        border-radius: 12px;
        text-align: center;
    }

    .report-card h4 {
        color: var(--text-muted);
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
        text-transform: uppercase;
    }

    .report-value {
        font-size: 1.8rem;
        font-weight: 800;
    }

    .text-accent { color: var(--accent); }
    .text-success { color: var(--success); }
    .text-warning { color: #eab308; } /* Yellow */
    .mt-1 { margin-top: 1rem; }

    /* --- MOBILE RESPONSIVENESS --- */
    @media (max-width: 1024px) {
        .main-content {
            grid-template-columns: 1fr 350px;
        }
    }

    @media (max-width: 768px) {
        .app-container {
            padding: 0.75rem;
            height: auto;
            min-height: 100vh;
        }

        .main-content {
            display: flex;
            flex-direction: column;
        }

        .products-section {
            overflow-y: visible; /* Let document scroll naturally on mobile */
        }

        .app-header {
            flex-direction: column;
            gap: 1rem;
        }

        .header-right {
            width: 100%;
            justify-content: space-between;
        }

        .report-summary-cards {
            grid-template-columns: 1fr;
        }

        .add-product-form, .report-controls {
            flex-direction: column;
        }

        .admin-tabs {
            flex-direction: column;
            gap: 0.5rem;
        }
        
        .tab-btn {
            width: 100%;
        }

        .table-container {
            overflow-x: auto;
        }
        
        .payment-method-selector {
            flex-direction: column;
        }
    }

}

/* --- PRINT LAYOUT (THERMAL PRINTER ONLY) --- */
@media print {
    /* Set page margins for thermal printer (usually 80mm roll width) */
    @page {
        margin: 0;
        size: 80mm auto;
    }

    /* Hide the UI */
    .no-print {
        display: none !important;
    }

    /* Print settings reset */
    body {
        background: white !important;
        color: black !important;
        margin: 0;
        padding: 0;
        font-family: Arial, Helvetica, sans-serif; /* Corporate sans-serif font */
        font-size: 13px; /* Slightly larger, clearer base font */
        line-height: 1.3;
    }

    * {
        box-sizing: border-box;
    }

    .receipt-container {
        width: 100%;
        max-width: 80mm;
        margin: 0 auto;
        padding: 3mm 4mm;
        background: white;
    }

    /* Helpers */
    .text-center { text-align: center; }
    .text-right { text-align: right; }
    .text-left { text-align: left; }
    .strong { font-weight: bold; }
    
    .divider {
        margin: 6px 0;
        width: 100%;
    }

    .divider.dashed {
        border-top: 1px dashed black;
    }

    .divider.solid {
        border-top: 2px solid black;
    }

    /* Header */
    .receipt-header {
        text-align: center;
        margin-bottom: 8px;
    }

    .receipt-logo-img {
        max-width: 70%;
        max-height: 80px;
        margin: 0 auto 8px auto;
        display: block;
        object-fit: contain;
    }

    .receipt-header h2 {
        font-size: 20px;
        font-weight: 900;
        margin: 0 0 4px 0;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .receipt-header p {
        margin: 2px 0;
        font-size: 12px;
    }

    .receipt-meta {
        font-size: 12px;
        margin: 6px 0;
    }

    .receipt-meta p {
        margin: 3px 0;
        display: flex;
        justify-content: space-between;
    }

    .section-heading {
        background-color: black;
        color: white;
        text-align: center;
        padding: 4px;
        font-size: 14px;
        margin: 8px 0;
        font-weight: bold;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Body (Items) */
    .receipt-body {
        margin-bottom: 12px;
    }

    .receipt-items-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 13px;
        margin-bottom: 4px;
    }

    .receipt-items-table th {
        border-bottom: 1px solid black;
        padding-bottom: 4px;
        margin-bottom: 4px;
        font-weight: bold;
    }

    .receipt-items-table td, 
    .receipt-items-table th {
        padding: 4px 0;
        vertical-align: top;
    }

    .col-product { width: 55%; font-weight: bold; }
    .col-qty { width: 15%; text-align: center; font-weight: bold; }
    .col-price { width: 30%; text-align: right; }

    /* Totals */
    .receipt-totals {
        margin-top: 6px;
    }

    .total-line {
        display: flex;
        justify-content: space-between;
        font-size: 18px;
        font-weight: 900;
        margin-top: 6px;
    }

    /* Footer (Address & Notes) */
    .receipt-footer {
        margin-top: 12px;
    }

    .customer-info-block {
        margin-bottom: 8px;
    }

    .customer-info-block p {
        margin: 4px 0;
        font-size: 14px;
    }

    .address-text {
        white-space: pre-wrap;
        font-weight: bold;
        line-height: 1.4;
    }

    .note-block {
        border: 2px solid black;
        padding: 6px;
        margin-bottom: 8px;
        border-radius: 4px;
    }

    .note-block p {
        margin: 0;
    }

    .strong-note {
        font-weight: bold;
        font-size: 14px;
        margin-top: 2px !important;
    }

    .thank-you {
        text-align: center;
        font-weight: bold;
        margin-top: 12px !important;
        font-size: 14px;
    }

    .afiyet-olsun {
        text-align: center;
        font-size: 16px;
        font-weight: 900;
        margin-top: 6px !important;
    }

    .software-credit {
        text-align: center;
        font-size: 10px;
        margin-top: 12px !important;
        color: #333;
    }
}
