/* ================================================
   RESTAURANT ORDERING SYSTEM - IMPROVED CSS
   ================================================ */

/* ================================================
   RESET AND BASE STYLES
   ================================================ */
* { 
    box-sizing: border-box; 
}

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

/* ================================================
   LAYOUT COMPONENTS
   ================================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.header {
    background: linear-gradient(45deg, #FF6B6B, #4ECDC4);
    color: white;
    padding: 20px;
    text-align: center;
}

.header h1 {
    margin: 0;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 300;
    letter-spacing: 1px;
}

/* ================================================
   NAVIGATION TABS
   ================================================ */
.tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.tab {
    flex: 1;
    padding: 15px 10px;
    background: #f8f9fa;
    border: none;
    cursor: pointer;
    font-size: clamp(0.8rem, 2.2vw, 1rem);
    font-weight: 500;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab:hover {
    background: #e9ecef;
}

.tab.active {
    background: white;
    color: #FF6B6B;
    border-bottom-color: #FF6B6B;
}

.tab-content {
    display: none;
    padding: 20px;
}

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

/* ================================================
   DISCOUNT SECTION
   ================================================ */
.global-discount {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: center;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.global-discount h3 {
    margin: 0 0 15px 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.discount-input {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.discount-input input {
    width: 80px;
    padding: 8px;
    border: none;
    border-radius: 6px;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
}

/* ================================================
   GROUP ORDER SECTION
   ================================================ */
.group-section {
    background: linear-gradient(45deg, #4ECDC4, #44A08D);
    color: white;
    padding: 20px;
    margin: 20px 0;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

.group-section h3 {
    margin: 0 0 15px 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.group-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.group-input {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 15px 0;
    justify-content: center;
    flex-wrap: wrap;
}

.group-input input {
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    text-align: center;
    text-transform: uppercase;
    font-weight: bold;
    min-width: 150px;
}

.group-code {
    font-size: 1.5rem;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.2);
    padding: 15px 25px;
    border-radius: 25px;
    margin: 15px 0;
    letter-spacing: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    backdrop-filter: blur(10px);
}

.copy-code-btn {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.7em;
    font-weight: normal;
    transition: all 0.3s ease;
}

.copy-code-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

/* ================================================
   USER BADGES AND ORDERS
   ================================================ */
.user-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    margin: 3px;
    display: inline-block;
    transition: all 0.3s ease;
}

.user-badge.current-user {
    background: rgba(255, 255, 255, 0.4);
    font-weight: bold;
}

.user-badge.shared-user {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.my-order-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.my-order-item:last-child {
    border-bottom: none;
}

.my-order-item .quantity-right {
    margin-left: auto;
    margin-right: 15px;
    font-weight: bold;
    font-size: 1.1rem;
}

.split-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    margin: 5px;
    transition: all 0.3s ease;
}

.split-toggle.active {
    background: rgba(255, 255, 255, 0.3);
    font-weight: bold;
}

.my-total {
    background: rgba(255, 255, 255, 0.15);
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    backdrop-filter: blur(5px);
}

/* ================================================
   USER ORDERS DISPLAY
   ================================================ */
.user-orders {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin: 15px 0;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-orders h4 {
    background: #f8f9fa;
    margin: 0;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    font-size: 1.1rem;
    color: #495057;
    font-weight: 600;
}

.user-orders-list {
    padding: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.user-orders-list div {
    padding: 6px 0;
    border-bottom: 1px solid #000000;
}

.user-orders-list div:last-child {
    border-bottom: none;
}

.user-orders.shared-dishes {
    background: #f8f9fa;
    border-left: 4px solid #014853;
}

.user-orders.shared-dishes h4 {
    color: #495057;
    background: #e9ecef;
}

/* ================================================
   SHARED DISHES SELECTION
   ================================================ */
.shared-dishes-selection {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
}

.shared-dishes-selection h4 {
    margin: 0 0 20px 0;
    color: #495057;
    font-size: 1.2rem;
    font-weight: 600;
}

.shared-selection-options label {
    display: block;
    margin: 15px 0;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 0;
    font-size: 1rem;
}

.shared-selection-options input[type="radio"] {
    margin-right: 10px;
    transform: scale(1.1);
}

.shared-users-checkboxes {
    margin: 15px 0 0 25px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.shared-users-checkboxes label {
    margin: 5px 0;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: normal;
}

.shared-users-checkboxes label:hover {
    background-color: #e9ecef;
}

.shared-users-checkboxes input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.1);
}

/* ================================================
   MENU TABLE
   ================================================ */
.menu-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.menu-table th {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 15px 10px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
}

.menu-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e9ecef;
    word-wrap: break-word;
}

.menu-table tr:nth-child(even) { 
    background: #fafbfc; 
}

.menu-table tr:hover {
    background: #f8f9fa;
}

.price {
    font-weight: bold;
    color: #28a745;
    white-space: nowrap;
    font-size: 1.1em;
}

.category-header {
    background: linear-gradient(45deg, #FF6B6B, #4ECDC4);
    color: white;
    font-weight: bold;
    text-align: center;
    padding: 15px;
    font-size: 15px;
    letter-spacing: 1px;
}

/* ================================================
   CALCULATOR SECTION
   ================================================ */
.calc-section {
    background: #f8f9fa;
    padding: 20px;
    margin: 20px 0;
    border-radius: 10px;
    border: 1px solid #dee2e6;
}

.calc-header {
    background: #fff;
    padding: 15px 20px;
    margin: 0 0 20px 0;
    border-radius: 8px;
    font-weight: 600;
    color: #495057;
    border: 1px solid #dee2e6;
    font-size: 1.2rem;
    text-align: center;
}

.order-input {
    display: grid;
    grid-template-columns: 80px 1fr 80px 1fr 60px;
    gap: 12px;
    margin: 10px 0;
    padding: 15px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.order-input input,
.order-input select {
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.order-input input:focus,
.order-input select:focus {
    outline: none;
    border-color: #4ECDC4;
    box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.1);
}

.order-input input[type="number"] {
    text-align: center;
    font-weight: bold;
}

/* ================================================
   BUTTONS
   ================================================ */
.btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    margin: 5px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn:hover { 
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-remove {
    background: linear-gradient(45deg, #dc3545, #c82333) !important;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

.btn-remove:hover {
    background: linear-gradient(45deg, #c82333, #bd2130) !important;
    transform: translateY(-1px);
}

.btn-success { 
    background: linear-gradient(45deg, #28a745, #20c997);
}

.btn-warning { 
    background: linear-gradient(45deg, #ffc107, #fd7e14);
    color: #212529; 
}

/* ================================================
   TOTAL SECTION
   ================================================ */
.total-section {
    background: linear-gradient(45deg, #FF6B6B, #4ECDC4);
    color: rgb(0, 0, 0);
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    margin-top: 25px;
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
}

.total-amount {
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: bold;
    margin: 15px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.total-amount-small {
    font-size: 0.7em;
    opacity: 0.9;
    margin-top: 8px;
}

/* ================================================
   FORM ELEMENTS
   ================================================ */
.search-box {
    width: 100%;
    padding: 15px;
    margin: 20px 0;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.search-box:focus {
    outline: none;
    border-color: #4ECDC4;
    box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.1);
}

.order-output {
    background: #fff3cd;
    border: 2px solid #ffeaa7;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
}

.order-output textarea {
    width: 100%;
    height: 150px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    resize: vertical;
    line-height: 1.4;
}

/* ================================================
   MESSAGES
   ================================================ */
.error-msg {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    text-align: center;
    border: 1px solid #f5c6cb;
}

.success-msg {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    text-align: center;
    border: 1px solid #c3e6cb;
}

/* ================================================
   RESPONSIVE DESIGN
   ================================================ */

/* Tablet */
@media (max-width: 768px) {
    .container {
        border-radius: 10px;
    }
    
    .header {
        padding: 15px;
    }
    
    .tab-content {
        padding: 15px;
    }
    
    .menu-table {
        font-size: 12px;
    }
    
    .menu-table th:nth-child(1) { width: 40px; }
    .menu-table th:nth-child(2) { width: 30%; }
    .menu-table th:nth-child(3) { width: 50%; }
    .menu-table th:nth-child(4) { width: 20%; }
    
    .menu-table td {
        padding: 8px 5px;
        font-size: 11px;
    }
    
    .menu-table td:nth-child(3) {
        font-size: 10px;
        line-height: 1.3;
    }
    
    .order-input {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .order-input input,
    .order-input select {
        width: 100%;
    }
    
    .shared-users-checkboxes {
        grid-template-columns: 1fr;
    }
    
    .group-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .group-input {
        flex-direction: column;
    }
    
    .group-input input {
        width: 100%;
        min-width: auto;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .order-input {
        grid-template-columns: 50px 1fr 55px 40px;
        gap: 5px;
        padding: 10px;
    }
    
    .order-input input, 
    .order-input select {
        padding: 8px 4px;
        font-size: 13px;
    }
}

/* Small Mobile */
@media (max-width: 390px) {
    body { 
        padding: 5px; 
    }
    
    .container { 
        border-radius: 8px; 
    }
    
    .header { 
        padding: 12px; 
    }
    
    .tab-content { 
        padding: 10px; 
    }
    
    .calc-section { 
        padding: 12px; 
    }
    
    .order-input {
        grid-template-columns: 38px 1fr 45px 32px;
        gap: 3px;
        padding: 8px;
        margin-bottom: 8px;
    }
    
    .order-input input, 
    .order-input select {
        padding: 6px 3px;
        font-size: 11px;
    }
    
    .btn-remove {
        padding: 6px 8px;
        font-size: 10px;
    }
    
    .group-code {
        font-size: 1.2rem;
        padding: 12px 20px;
        letter-spacing: 2px;
    }
    
    .total-section {
        padding: 20px;
    }
}