/* Main wide white background container for all main pages */
.main-container {
    width: 98%;
    max-width: 1400px;
    margin: 40px auto 40px auto;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.10);
    padding: 36px 32px 32px 32px;
    min-height: 80vh;
}
/* Unified main title style for management pages */
.main-title {
    font-size: 2.2rem;
    font-weight: bold;
    color: #fff;
    background: #007bff;
    padding: 16px 0 16px 0;
    margin-bottom: 24px;
    border-radius: 8px;
    text-align: center;
    letter-spacing: 1px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
/* Show .print-only only during print/print preview */
@media print {
  .print-only {
    display: block !important;
  }
}

@media screen {
  .print-only {
    display: none !important;
  }
}
/* General body styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    /* Replace '/static/your-image.jpg' with the path to your desired background image */
    background: url('/static/backgound.jpg') no-repeat center center fixed;
    background-size: cover; /* Ensures the image covers the entire viewport */
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* Align content to the top */
    height: 100%; /* Allow content to grow vertically */
}


/* Navigation Bar */
.navbar {
    display: flex;
    justify-content: center;
    background-color: #333;
    padding: 10px 0;
    margin-bottom: 20px;
}

.navbar .nav-link {
    color: white;
    text-decoration: none;
    margin: 0 15px;
    font-size: 18px;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 5px;
}

.navbar .nav-link:hover {
    background-color: #0056b3;
}

.navbar .nav-link.active {
    background-color: #007bff;
}

/* Center the container with dynamic width */
.container {
    width: 90%; /* Use 90% of the screen width */
    max-width: 1400px; /* Limit the width for large screens */
    text-align: center;
    background-color: #ffffff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: none; /* Subtle shadow for the container */
}


/* Metric styling */
.metric {
    background-color: #f9f9f9; /* Light gray background for the boxes */
    border: 1px solid #ddd; /* Light border for the boxes */
    border-radius: 8px; /* Rounded corners */
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Subtle shadow for metrics */
    transition: transform 0.2s ease, box-shadow 0.2s ease; /* Add hover effect */
}

.metric:hover {
    transform: translateY(-5px); /* Slight lift on hover */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Stronger shadow on hover */
}

.metric h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #333;
}

.metric p {
    font-size: 24px;
    font-weight: bold;
    color: #007bff;
}

/* Total Clients Box */
.total-clients-box {
    background-color: #f2f2f2; /* Light gray background */
    padding: 20px;
    border: 1px solid #ddd; /* Light border */
    border-radius: 8px; /* Rounded corners */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Subtle shadow */
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease; /* Add hover effect */
}

.total-clients-box:hover {
    transform: translateY(-5px); /* Slight lift on hover */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Stronger shadow on hover */
}

.total-clients-box h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: #333;
}

.total-clients {
    font-size: 28px;
    font-weight: bold;
    color: #28a745;
}

/* Highlight matching search results */
.highlight {
    background-color: #ffff99; /* Light yellow */
}

/* Table styling */
table {
    width: 100%; /* Table takes up full container width */
    border-collapse: collapse; /* Remove gaps between table cells */
    margin-top: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Add subtle shadow */
}

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

thead {
    background-color: #f4f4f4;
}

/* General Table Styling */
.clients-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-family: Arial, sans-serif;
    font-size: 14px;
}

.clients-table th, .clients-table td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
}

.clients-table th {
    background-color: #f4f4f4;
    font-weight: bold;
    text-align: center;
}

.clients-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.clients-table tr:hover {
    background-color: #f1f1f1;
}

/* General Table Styling */
.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    background-color: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.modern-table th, .modern-table td {
    padding: 15px;
    text-align: left;
}

.modern-table th {
    background-color: #007bff;
    color: white;
    font-weight: bold;
    text-align: center;
}

.modern-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.modern-table tbody tr:hover {
    background-color: #f1f1f1;
}

/* Table Borders */
.modern-table tbody tr td:first-child,
.modern-table tbody tr th:first-child {
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}

.modern-table tbody tr td:last-child,
.modern-table tbody tr th:last-child {
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

/* Center text in the ID column */
.modern-table td:first-child, 
.modern-table th:first-child {
    text-align: center;
}

/* Limit the width of table columns */
table.modern-table th,
table.modern-table td {
    max-width: 150px; /* Adjust as needed */
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

/* Options Column Styling */
.options-column {
    width: 150px; /* Adjust this value to fit the buttons */
    text-align: center;
    white-space: nowrap; /* Prevent buttons from wrapping */
}

/* Button Styling */
.btn {
    display: inline-block;
    padding: 8px 12px;
    font-size: 14px;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

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

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

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

.btn-danger:hover {
    background-color: #a71d2a;
}

.btn:hover {
    opacity: 0.9;
}

/* Form styling */
form {
    margin-top: 20px;
}

form input, form select, form button {
    padding: 10px;
    margin: 5px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-weight: bold;
}

form select {
    width: 100%;
    max-width: 300px; /* Matches the input fields */
    margin-bottom: 10px;
}

/* Adjust the dropdown width */
select#payment_method {
    width: 150px; /* Set a fixed width */
    max-width: 100%; /* Ensure it doesn't overflow */
    padding: 5px;
    font-size: 14px;
}

form button {
    cursor: pointer;
    background-color: #007bff; /* Blue background */
    color: white; /* White text */
    border: none;
    border-radius: 5px;
    transition: background-color 0.3s;
}

form button:hover {
    background-color: #0056b3; /* Darker blue on hover */
}

/* Specific styling for "Add", "Update", and "Delete" buttons */
button.add-btn, button.update-btn, button.delete-btn {
    background-color: #007bff; /* Same blue background */
    color: white; /* White text */
    font-weight: bold;
    border: none;
    border-radius: 5px;
    padding: 8px 12px;
    font-size: 14px;
}

button.add-btn:hover, button.update-btn:hover, button.delete-btn:hover {
    background-color: #0056b3; /* Darker blue on hover */
}

/* Inline Forms for Table Actions */
.inline-form {
    display: inline; /* Allow forms to display side-by-side */
}

/* Link for clearing the search */
form .clear-search {
    text-decoration: none;
    color: red;
    margin-left: 10px;
}

form .clear-search:hover {
    text-decoration: underline;
}

/* Success and error message styling */
.success {
    color: green;
}

.error {
    color: red;
}

/* Pagination Styles */
.pagination-container {
    margin-top: 20px;
}

.pagination {
    display: flex;
    justify-content: center;
    padding-left: 0;
    list-style: none;
    border-radius: 0.25rem;
}

.page-item {
    margin: 0 5px;
}

.page-item .page-link {
    color: #007bff;
    text-decoration: none;
    background-color: #ffffff;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.page-item .page-link:hover {
    background-color: #007bff;
    color: #ffffff;
    border-color: #007bff;
}

.page-item.active .page-link {
    background-color: #007bff;
    color: #ffffff;
    border-color: #007bff;
}

.page-item.disabled .page-link {
    color: #6c757d;
    pointer-events: none;
    background-color: #e9ecef;
    border-color: #ddd;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        width: 100%; /* Use full width on small screens */
        padding: 10px;
    }

    table {
        font-size: 14px; /* Reduce font size for smaller screens */
    }

    th, td {
        padding: 8px;
    }

    form input, form select, form button {
        width: 100%; /* Full width inputs on mobile */
        max-width: none; /* Remove max-width restriction */
    }
}

.dropdown {
    position: relative;
    background: #ffffff;
    border: 1px solid #ddd;
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
    margin-top: 5px;
    display: none; /* Hidden by default */
    z-index: 1000;
}

.dropdown-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #ddd;
}

.dropdown-item:hover {
    background-color: #f4f4f4;
}

/* Generate invoice button */
.btn-generate-invoice {
    background-color: #007bff; /* Blue color */
    color: white; /* White text */
    border: none; /* Remove borders */
    padding: 10px 20px; /* Add padding for the button */
    font-size: 16px; /* Font size */
    cursor: pointer; /* Pointer cursor on hover */
    border-radius: 4px; /* Rounded corners */
    text-transform: uppercase; /* Optional: Uppercase text */
}

.btn-generate-invoice:hover {
    background-color: #0056b3; /* Darker blue on hover */
    color: white; /* Ensure text stays white */
}

/* home style */
.company-info {
    margin-top: 20px;
    padding: 20px;
    background-color: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    line-height: 1.5;
}

.company-info strong {
    color: #007bff; /* Makes text blue */
}

.company-info a {
    text-decoration: none;
    color: #007bff; /* Makes links blue */
}

.company-info a:hover {
    text-decoration: underline; /* Adds underline when mouse is over link */
}

/* manage orders [REMOVE] button */
.remove-btn {
    background-color: blue;
    color: white;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 3px;
}

.remove-btn:hover {
    background-color: blue;
}

.update-btn {
    background-color: green;
    color: white;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 3px;
}

.update-btn:hover {
    background-color: darkgreen;
}

/* back to orders button */
.btn-back-to-orders {
    background-color: #007bff; 
    color: white; 
    padding: 10px 20px; 
    border: none; 
    border-radius: 5px; 
    text-decoration: none; 
    font-size: 14px; 
    cursor: pointer;
}

.btn-back-to-orders:hover {
    background-color: #0056b3; 
}

/* settings buttons control */
.admin-btn {
    display: inline-block;
    margin: 5px;
    padding: 10px 20px;
    background-color: #007bff; 
    color: white; 
    text-decoration: none;
    border-radius: 5px; 
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.admin-btn:hover {
    background-color: #e90d48;
}

/* Invoice Styles */
.invoice-container {
    width: 800px;
    margin: 20px auto;
    background-color: #fff;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.invoice-container .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.invoice-container .header .company-info {
    text-align: right;
    font-size: 14px;
    line-height: 1.6;
}

.invoice-container .header h1 {
    font-size: 24px;
    margin: 0;
}

.invoice-container .header p {
    margin: 0;
    font-size: 14px;
    color: #777;
}

.invoice-container .info-section {
    margin-bottom: 20px;
}

.invoice-container .info-section div {
    margin-bottom: 5px;
}

.invoice-container .info-section strong {
    font-weight: bold;
}

.invoice-container .invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.invoice-container .invoice-table th,
.invoice-container .invoice-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.invoice-container .invoice-table th {
    background-color: #f4f4f4;
}

.invoice-container .total-section {
    text-align: right;
    font-size: 16px;
    font-weight: bold;
}

.invoice-container .footer {
    text-align: center;
    font-size: 12px;
    color: #777;
}

.invoice-container .actions {
    margin-top: 20px;
    text-align: right;
}

.invoice-container .actions button {
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    margin-left: 10px;
}

/* Hide elements when printing */
@media print {
    .invoice-container .actions {
        display: none;
    }
}

@page {
    size: A4;
    margin: 2cm;
}
.invoice-container {
    page-break-inside: avoid;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
}

.invoice-table th, .invoice-table td {
    border: 1px solid #ddd;
    padding: 8px;
}

.total-section {
    margin-top: 20px;
    text-align: right;
    page-break-inside: avoid;
}

/* Styling for the admin users table */
.admin-users-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-family: Arial, sans-serif;
}

.admin-users-table th, .admin-users-table td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
}

.admin-users-table th {
    background-color: #f4f4f4;
    font-weight: bold;
    text-align: center;
}

.admin-users-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.admin-users-table tr:hover {
    background-color: #f1f1f1;
}

.admin-users-table td {
    vertical-align: middle;
}

.admin-users-table .btn {
    padding: 5px 10px;
    font-size: 14px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
}

.admin-users-table .btn.admin-btn {
    background-color: #007bff;
    color: white;
    border: none;
    cursor: pointer;
}

.admin-users-table .btn.admin-btn:hover {
    background-color: #0056b3;
}

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

.admin-users-table .btn-danger:hover {
    background-color: #bd2130;
}


/* Alert test */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-weight: bold;
}
.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}
.alert-error, .alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}
.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}
.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

/* manage_products table */
.product-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: none;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
}

/* Make the "new product" name field easier to use */
.new-product-name-input {
    width: min(520px, 90%);
}

/* Заглавен ред */
.product-table thead tr {
    background-color: #007bff !important;
    color: white !important;
}

/* Ядро на таблицата */
.product-table th,
.product-table td {
    border-right: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    padding: 12px;
    text-align: center;
    vertical-align: middle;
    background-color: white;
}

/* Редуване на редовете */
.product-table tr:nth-child(even) td {
    background-color: #f9f9f9;
}

/* Премахване на долна рамка от последния ред */
.product-table tr:last-child td {
    border-bottom: none;
}

/* Премахване на дясна рамка от последната клетка */
.product-table th:last-child,
.product-table td:last-child {
    border-right: none;
}

/* Заглавия с дебел текст */
.product-table thead th {
    font-weight: bold;
    background-color: #007bff !important;
    color: white !important;
}

/* Заобляне на горните ъгли */
.product-table thead tr:first-child th:first-child {
    border-top-left-radius: 10px;
}

.product-table thead tr:first-child th:last-child {
    border-top-right-radius: 10px;
}

.product-table .product-name-cell {
    width: 260px;
    min-width: 220px;
    max-width: 520px;
}

.product-table .product-name-input,
.product-table .product-name-text {
    display: block;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* On click/focus, temporarily expand the name field for editing */
.product-table .product-name-input:focus {
    width: min(520px, 65vw);
    min-width: 320px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    position: relative;
    z-index: 20;
}

@media (max-width: 768px) {
    .product-table .product-name-cell {
        min-width: 160px;
    }
    .product-table .product-name-input:focus {
        width: 92vw;
        min-width: 92vw;
    }
}

.product-table input[name="delivery_price"] {
    width: 100px;
}

/* ===================================== */
/* Global invalid input visual styling   */
/* Applied when JS adds .input-error     */
/* ===================================== */
.input-error {
    border: 2px solid #dc3545 !important; /* prominent red border */
    background: #fff5f5 !important;       /* subtle red-tinted background */
    box-shadow: 0 0 0 2px rgba(220,53,69,0.15); /* soft glow */
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.input-error:focus {
    outline: none;
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220,53,69,0.25);
    background: #ffecec;
}

/* Optional placeholder tint when invalid */
.input-error::placeholder {
    color: #c74a52;
}

/* For number inputs with spin buttons (Webkit) keep red border visible */
.input-error::-webkit-outer-spin-button,
.input-error::-webkit-inner-spin-button {
    margin: 0; /* normalize */
}



