/* General styles for a modern, app-like feel */
:root {
    --primary-color: #007bff; /* Blue */
    --secondary-color: #6c757d; /* Gray */
    --success-color: #28a745; /* Green */
    --warning-color: #ffc107; /* Yellow */
    --danger-color: #dc3545; /* Red */
    --info-color: #17a2b8; /* Cyan/Turquoise */
    --dark-color: #343a40; /* Dark Gray */
    --light-color: #f8f9fa; /* Light Gray */

    --border-radius: 8px;
    --shadow-light: 0 2px 5px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 8px rgba(0, 0, 0, 0.15);
}

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

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    background-color: var(--light-color);
    color: var(--dark-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-medium);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header h1 {
    margin: 0;
    font-size: 1.8em;
}

header nav p {
    margin: 0;
    font-size: 0.9em;
}

header nav a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.2s ease;
}

header nav a:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Main Content Area */
main {
    flex-grow: 1;
    padding: 20px;
    max-width: 1200px; /* Max width for content */
    margin: 20px auto;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
}

/* Section Headings */
h2 {
    font-size: 1.5em;
    color: var(--primary-color);
    margin-bottom: 15px;
    border-bottom: 2px solid var(--light-color);
    padding-bottom: 10px;
}

/* Messages (Success/Error) */
.message {
    padding: 12px 20px;
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.message.success {
    background-color: #e9f5ed; /* Light green */
    color: var(--success-color);
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8e5e5; /* Light red */
    color: var(--danger-color);
    border: 1px solid #f5c6cb;
}

/* Form Groups */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--dark-color);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    font-size: 1em;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
    outline: none;
}

/* Buttons */
button, .btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button:hover, .btn:hover {
    transform: translateY(-1px);
}

button:active, .btn:active {
    transform: translateY(0);
}

/* Primary Button (e.g., Login, Add Product) */
button[type="submit"],
.btn-primary {
    background-color: var(--primary-color);
    color: white;
}
button[type="submit"]:hover,
.btn-primary:hover {
    background-color: #0056b3;
}

/* Success Button (e.g., Complete, Print Bill) */
.btn-success,
.status-completed { /* For status badges */
    background-color: var(--success-color);
    color: white;
}
.btn-success:hover {
    background-color: #218838;
}

/* Danger Button (e.g., Cancel) */
.btn-danger,
.status-canceled { /* For status badges */
    background-color: var(--danger-color);
    color: white;
}
.btn-danger:hover {
    background-color: #c82333;
}

/* Info Button (e.g., In Progress) */
.btn-info,
.status-in_progress { /* For status badges */
    background-color: var(--info-color);
    color: white;
}
.btn-info:hover {
    background-color: #117a8b;
}

/* Warning Button (e.g., Pending) */
.btn-warning,
.status-pending { /* For status badges */
    background-color: var(--warning-color);
    color: var(--dark-color); /* Text color might need to be dark for readability */
}
.btn-warning:hover {
    background-color: #e0a800;
}

/* Link Button (e.g., admin_settings.php) */
.btn-link {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 10px 15px;
}
.btn-link:hover {
    background-color: var(--primary-color);
    color: white;
}


/* --- Specific styles for index.php (Table Grid) --- */
.table-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); /* Larger touch targets */
    gap: 25px;
    padding: 15px;
    /* background-color: var(--light-color); */ /* Already covered by main background */
    border-radius: var(--border-radius);
    /* box-shadow: var(--shadow-light); */ /* Already covered by main shadow */
}

.table-card {
    background-color: white;
    border: 1px solid #eee;
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow-light);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 150px; /* Larger touch area */
    position: relative;
    overflow: hidden;
    cursor: pointer;
}
.table-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
    border-color: var(--primary-color);
}
.table-card a {
    text-decoration: none;
    color: var(--dark-color);
    font-weight: bold;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
.table-number {
    font-size: 2.5em; /* Larger number */
    margin-bottom: 5px;
    color: var(--primary-color);
}
.table-card.available {
    /* Default appearance, maybe subtle green border */
    border-color: #d4edda;
}
.table-card.occupied {
    /* Highlight for occupied tables */
    background-color: #fff3cd; /* Light yellow */
    border-color: var(--warning-color);
}

/* Indicator for products in pending/in_progress status */
.products-pending {
    background-color: var(--danger-color); /* Red badge for pending orders */
    color: white;
    border-radius: 50%; /* Circular badge */
    padding: 5px 10px;
    font-size: 0.85em;
    position: absolute;
    top: 10px;
    right: 10px;
    min-width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.products-pending.no-pending {
    background-color: var(--success-color); /* Green when no orders */
}
.products-pending.no-pending::before {
    content: '✓'; /* Checkmark for no pending orders */
    font-size: 1.2em;
}
.products-pending.no-pending span {
    display: none; /* Hide number when no pending */
}


/* --- Specific styles for view_table_orders.php --- */
.page-layout {
    display: flex;
    flex-direction: column; /* Default to column for small screens */
    gap: 20px;
}

@media (min-width: 768px) {
    .page-layout {
        flex-direction: row; /* Side-by-side for larger screens */
        align-items: flex-start; /* Align items to the top */
    }
    .current-orders {
        flex: 2; /* Takes more space */
    }
    .add-product-form {
        flex: 1; /* Takes less space */
        position: sticky; /* Make it sticky while scrolling orders */
        top: 20px; /* Adjust based on header height */
    }
}

/* Order Table */
.order-table {
    width: 100%;
    border-collapse: separate; /* For rounded corners */
    border-spacing: 0;
    margin-top: 20px;
    box-shadow: var(--shadow-light);
    border-radius: var(--border-radius);
    overflow: hidden; /* Ensures rounded corners apply */
}

.order-table th, .order-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee; /* Only horizontal borders */
}

.order-table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9em;
}
.order-table th:first-child { border-top-left-radius: var(--border-radius); }
.order-table th:last-child { border-top-right-radius: var(--border-radius); }


.order-table tbody tr {
    background-color: white;
    transition: background-color 0.2s ease;
}

.order-table tbody tr:nth-child(even) {
    background-color: #fbfbfb; /* Subtle stripe */
}

.order-table tbody tr:hover {
    background-color: #f0f0f0;
}

/* Specific column width adjustments */
.order-table td:nth-child(1) { /* Product name */
    width: 35%;
}
.order-table td:nth-child(2) { /* Quantity */
    width: 10%;
    text-align: center;
}
.order-table td:nth-child(3) { /* Price */
    width: 15%;
    text-align: right;
}
.order-table td:nth-child(4) { /* Status */
    width: 15%;
    text-align: center;
}
.order-table td:nth-child(5) { /* Notes */
    width: 15%;
}
.order-table td:nth-child(6) { /* Actions */
    width: 10%;
    text-align: center;
    white-space: nowrap; /* Keep buttons on one line */
}


/* Status Badges */
.status-pending,
.status-in_progress,
.status-completed,
.status-canceled {
    display: inline-block;
    padding: 5px 10px;
    border-radius: var(--border-radius);
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
}
.status-pending {
    background-color: var(--warning-color);
    color: var(--dark-color);
}
.status-in_progress {
    background-color: var(--info-color);
    color: white;
}
.status-completed {
    background-color: var(--success-color);
    color: white;
}
.status-canceled {
    background-color: var(--danger-color);
    color: white;
}

/* Action Buttons within table */
.order-table .action-buttons button {
    padding: 8px 12px;
    font-size: 0.85em;
    margin: 3px;
    border-radius: 5px;
}

/* Total Bill Section */
.total-bill {
    text-align: right;
    font-size: 1.4em;
    font-weight: bold;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--light-color);
    color: var(--dark-color);
}

.print-bill-button {
    width: auto; /* Allow button to size based on content */
    margin: 20px 0 0 auto; /* Center align for main (or push to right) */
    display: block; /* Make it take full width on small screens if desired, or just block level for margin */
    /* Ensure it's a success button style */
    background-color: var(--success-color);
    color: white;
    padding: 15px 30px;
    border-radius: var(--border-radius);
    font-size: 1.2em;
    box-shadow: var(--shadow-light);
}
.print-bill-button:hover {
    background-color: #218838;
}

/* Add Product Form */
.add-product-form {
    background-color: #f9f9f9;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    margin-top: 20px; /* Space from orders table on small screens */
}

/* Product dropdown/select styles */
.add-product-form select,
.add-product-form input[type="number"],
.add-product-form textarea {
    margin-bottom: 15px;
}

/* Login form specific styles */
.login-container {
    max-width: 450px;
    margin: 80px auto;
    padding: 30px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    text-align: center;
}
.login-container h1 {
    font-size: 2em;
    color: var(--primary-color);
    margin-bottom: 25px;
}
.login-container button[type="submit"] {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
}
