/* POS Sagra Pro - Stili Principali */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 28px;
}

.connection-status {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.connection-status.online {
    background: #28a745;
    color: white;
}

.connection-status.offline {
    background: #ffc107;
    color: #000;
}

/* Tabs */
.tabs {
    display: flex;
    background: #f5f5f5;
    border-bottom: 2px solid #ddd;
    overflow-x: auto;
}

.tab {
    padding: 15px 25px;
    cursor: pointer;
    background: #f5f5f5;
    border: none;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
}

.tab:hover {
    background: #e0e0e0;
}

.tab.active {
    background: white;
    border-bottom: 3px solid #667eea;
    color: #667eea;
}

/* Content */
.content {
    display: none;
    padding: 30px;
}

.content.active {
    display: block;
}

/* POS Layout */
.pos-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    max-height: 500px;
    overflow-y: auto;
}

.product-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: center;
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.product-card.menu-item {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.product-card h3 {
    font-size: 16px;
    margin-bottom: 10px;
}

.product-card .price {
    font-size: 20px;
    font-weight: bold;
}

.product-card .badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 255, 255, 0.3);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

/* Cart Section */
.cart-section {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #ddd;
}

.cart-items {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: white;
    margin-bottom: 10px;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.cart-item-info {
    flex: 1;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: #ffc107;
    color: #000;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.btn-small {
    padding: 5px 10px;
    font-size: 14px;
}

.btn-large {
    padding: 15px 30px;
    font-size: 18px;
}

/* Total Section */
.total-section {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 18px;
}

.total-row.grand-total {
    font-size: 28px;
    font-weight: bold;
    color: #667eea;
    border-top: 2px solid #ddd;
    padding-top: 10px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.form-group small {
    display: block;
    color: #666;
    margin-top: 5px;
    font-size: 13px;
}

/* Products List */
.products-list {
    display: grid;
    gap: 10px;
}

.product-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto auto;
    gap: 10px;
    align-items: center;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #ddd;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 10px;
    text-align: center;
}

.stat-card h3 {
    font-size: 18px;
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 36px;
    font-weight: bold;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
}

th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background: #667eea;
    color: white;
    font-weight: 600;
}

tr:hover {
    background: #f5f5f5;
}

/* Config Section */
.config-section {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
}

.config-section h3 {
    margin-bottom: 15px;
    color: #667eea;
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    position: relative;
    background: white;
    padding: 15px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    margin: 2vh auto;
    max-height: 96vh;
    overflow-y: auto;
}

.close-modal {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    z-index: 1;
}

.close-modal:hover {
    color: #333;
}

/* Payment Modal */
.payment-modal {
    padding-top: 25px;
}

.payment-modal h2 {
    text-align: center;
    margin-bottom: 10px;
    font-size: 20px;
}

.payment-total {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 10px;
}

.payment-total .label {
    font-size: 12px;
    opacity: 0.9;
}

.payment-total .amount {
    font-size: 28px;
    font-weight: bold;
    margin-top: 3px;
}

.calc-toggle {
    text-align: center;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 5px;
    cursor: pointer;
    margin-bottom: 10px;
    color: #667eea;
    font-weight: 600;
}

.calc-toggle:hover {
    background: #e9ecef;
}

.change-calculator {
    display: none;
    background: #fff3cd;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #ffc107;
    margin-bottom: 10px;
}

.change-calculator.show {
    display: block;
}

.change-calculator h4 {
    margin-bottom: 8px;
    color: #856404;
    font-size: 14px;
}

.money-input {
    width: 100%;
    padding: 10px;
    font-size: 20px;
    text-align: center;
    border: 2px solid #667eea;
    border-radius: 6px;
    margin-bottom: 8px;
}

.quick-money {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}

.money-btn {
    padding: 10px;
    font-size: 14px;
    font-weight: bold;
    border: 2px solid #667eea;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.money-btn:hover {
    background: #667eea;
    color: white;
}

.calc-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 8px;
}

.change-display {
    background: white;
    padding: 10px;
    border-radius: 6px;
}

.change-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 14px;
}

.change-row.main {
    font-size: 22px;
    font-weight: bold;
    color: #28a745;
    padding-top: 8px;
    border-top: 2px solid #28a745;
    margin-top: 8px;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Menu Builder */
.menu-builder {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.menu-items-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.menu-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 5px;
    border: 1px solid #ddd;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    animation: slideIn 0.3s ease-out, slideOut 0.3s ease-in 2.7s;
    opacity: 0;
    transform: translateX(400px);
    min-width: 300px;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.toast-icon {
    font-size: 32px;
}

.toast-text h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
}

.toast-text p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(400px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(400px);
    }
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    font-size: 16px;
    font-weight: 600;
    z-index: 10000;
    animation: slideIn 0.3s ease-out;
    min-width: 300px;
}

.toast.success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.toast.info {
    background: linear-gradient(135deg, #17a2b8 0%, #20c997 100%);
}

.toast.warning {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #000;
}

.toast.error {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.toast-icon {
    font-size: 24px;
}

.toast-message {
    flex: 1;
}

.toast-details {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 5px;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .pos-layout {
        grid-template-columns: 1fr;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

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

    .product-item {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .payment-total .amount {
        font-size: 24px;
    }

    .money-input {
        font-size: 18px;
    }

    .change-row.main {
        font-size: 20px;
    }

    .modal-content {
        width: 95%;
        padding: 12px;
    }

    .toast {
        top: 10px;
        right: 10px;
        left: 10px;
        min-width: auto;
    }
}

@media (max-height: 600px) {
    .payment-modal h2 {
        font-size: 18px;
        margin-bottom: 5px;
    }

    .payment-total {
        padding: 8px;
    }

    .payment-total .amount {
        font-size: 22px;
    }

    .money-btn {
        padding: 8px;
        font-size: 12px;
    }

    .btn-large {
        padding: 12px 20px;
        font-size: 16px;
    }
}
