/* Define color variables for easy customization */
:root {
    --primary-color: #454a3b;
    --primary-color-hover: #C1C6B8;
    --secondary-color: #f9f9f9;
    --text-color: #454a3b;
    --text-muted: #aaa;
    --alert-info-bg: #d9edf7;
    --alert-info-text: #31708f;
    --alert-info-border: #bce8f1;
    --alert-success-bg: #dff0d8;
    --alert-success-text: #3c763d;
    --alert-success-border: #d6e9c6;
    --input-border-color: #ccc;
    --box-shadow-color: rgba(0, 0, 0, 0.1);
    --highlight-bg-color: #eef2ff;
    --highlight-border-color: #333;
}

/* Load custom fonts */
@font-face {
    font-family: 'Duke Charming';
    src: url('../fonts/duke-charming.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Raleway';
    src: url('../fonts/raleway.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* Global styles */
body {
    font-family: 'Raleway', sans-serif;
    background-color: var(--secondary-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    text-align: center;
    box-sizing: border-box;
    line-height: 1.6;
    background-image: url('data:image/svg+xml,%3Csvg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="%239C92AC" fill-opacity="0.05" fill-rule="evenodd"%3E%3Ccircle cx="3" cy="3" r="3"/%3E%3Ccircle cx="13" cy="13" r="3"/%3E%3C/g%3E%3C/svg%3E');
}

/* Header styles - used in all templates */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Duke Charming', sans-serif;
    color: var(--text-color);
    margin-bottom: 20px;
    line-height: 1.2;
}

/* Logo link styling */
.logo a {
    text-decoration: none;
    display: inline-block;
}

.logo a:hover {
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

h1 { font-size: 1.5em; }
h2 { font-size: 1.2em; }

/* Body text styles - used in all templates */
p, input, textarea, label, form {
    font-family: 'Raleway', sans-serif;
    font-size: 1em;
}

/* Container styles - used in all templates */
.container {
    max-width: 500px;
    padding: 40px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 0 10px var(--box-shadow-color);
    text-align: center;
    margin: 20px auto;
}

/* Information group styling - used in customer_exists.html and order_summary.html */
.info-group {
    margin-bottom: 15px;
    text-align: left;
    
}

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

/* Info box styling - used in customer_exists.html */
.info-box {
    padding: 10px;
    background-color: var(--highlight-bg-color);
    border: 2px solid var(--highlight-border-color);
    border-radius: 8px;
    box-shadow: 0 0 5px var(--box-shadow-color);
    width: 100%;
}

/* Form input styles - used in all forms */
input[type="text"], input[type="submit"], textarea, .btn {
    padding: 15px;
    font-size: 0.8em;
    margin: 10px 0;
    width: 100%;
    border: 1px solid var(--input-border-color);
    border-radius: 8px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

input[type="submit"], .btn {
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
}

input[type="submit"]:hover, .btn:hover {
    background-color: var(--primary-color-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Placeholder color in input fields */
input[type="text"]::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

/* Logo styling - used in base.html */
.logo {
    margin-bottom: 0px;
}

.logo img {
    max-width: 150px;
}

/* Flash message styling - used in base.html */
.alert {
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid transparent;
    border-radius: 4px;
    text-align: left;
}

.alert-info {
    color: var(--alert-info-text);
    background-color: var(--alert-info-bg);
    border-color: var(--alert-info-border);
}

.alert-success {
    color: var(--alert-success-text);
    background-color: var(--alert-success-bg);
    border-color: var(--alert-success-border);
}

/* Product info styling - used in haloumi.html */
.product-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.product-info .info-card {
    background-color: var(--highlight-bg-color) !important;  /* Temporarily using !important to test */
    padding: 15px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    border: 1px solid var(--input-border-color);
    border-radius: 8px;
}

.product-info .info-card .info-label {
    font-size: 1em;
    color: var(--text-color);
    font-family: 'Raleway', sans-serif;
}

.product-info .info-card .info-value {
    font-size: 1em;
    color: var(--text-color);
    font-family: 'Raleway', sans-serif;
}

/* Stock limit message - used in haloumi.html */
.stock-limit-message {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 10px;
    margin-top: 10px;
    font-size: 0.9em;
}

/* Order summary styles - used in order_summary.html */
.order-summary {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.summary-content {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.info-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px dashed #ccc;
}

.info-section:last-child {
    border-bottom: none;
}

.info-section h2 {
    font-size: 1.2em;
    margin-bottom: 10px;
    color: #333;
    text-align: left;
}

/* Map styles - used in customer_exists.html and order_summary.html */
#map {
    height: 200px;
    width: 100%;
    margin-top: 20px;
    border-radius: 8px;
    overflow: hidden;
}

/* Mobile responsiveness */
@media (max-width: 600px) {
    .container {
        max-width: 100%;
        padding: 20px;
    }

    .logo img {
        max-width: 120px;
    }

    h1 { font-size: 2em; }
    h2 { font-size: 1.5em; }

    input[type="text"], input[type="submit"], textarea, .btn {
        padding: 12px;
        font-size: 1em;
    }

    .info-box {
        font-size: 0.8em;
    }
}

@media (min-width: 600px) {
    .container {
        max-width: 400px;
    }

    .logo img {
        max-width: 300px;
    }
}

/* Quantity control styling - used in haloumi.html */
.quantity-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.quantity-input {
    background-color: var(--highlight-bg-color);
    border: 1px solid var(--input-border-color);
    border-radius: 8px;
    padding: 5px 10px;
    width: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    margin-bottom: 20px;
}

#quantity {
    font-size: 1em;
    color: var(--text-color);
    font-family: 'Raleway', sans-serif;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    text-align: right;
    width: 30px;
}

.unit {
    font-size: 1em;
    color: var(--text-color);
    display: inline-block;
    margin-left: 2px;
}

/* Make buttons display horizontally */
.quantity-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.quantity-btn {
    width: 50px;
    height: 50px;
    font-size: 1.5em;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

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

.quantity-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Payment instructions specific styles */
.payment-instructions .order-details {
    margin-bottom: 30px;
}

.payment-instructions .info-card {
    margin-bottom: 10px;
}

.payment-instructions h2 {
    margin-top: 30px;
    margin-bottom: 20px;
}

.instruction-list {
    text-align: left;
    padding-left: 20px;
    margin-bottom: 30px;
}

.instruction-list li {
    margin-bottom: 15px;
}

.instruction-list strong {
    font-weight: bold;
    color: var(--primary-color);
}

.payment-instructions .form-group {
    margin-bottom: 20px;
}

.payment-instructions input[type="text"] {
    text-align: center;
}

.payment-instructions .btn {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    display: block;
}

/* Add this to your existing CSS file */

.btn-small {
    font-family: 'Raleway', sans-serif;
    font-size: 0.8em;
    padding: 8px 12px;
    margin: 5px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-edit {
    background-color: var(--primary-color);
    color: white;
}

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

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

.btn-save:hover {
    background-color: #218838;
}

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

.btn-cancel:hover {
    background-color: #c82333;
}

.info-box {
    display: block;
    /* width: calc(100% - 70px); Adjust based on your layout */
}

input[type="text"].info-box, input[type="tel"].info-box {
    display: block;
    /* width: calc(100% - 70px); Adjust based on your layout */
    padding: 8px;
    font-size: 0.9em;
}

/* WhatsApp contact button styles */
.whatsapp-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #25D366;
    color: white;
    border-radius: 50px;
    text-align: center;
    font-size: 16px;
    box-shadow: 2px 2px 3px #999;
    z-index: 100;
    padding: 10px 15px;
    text-decoration: none;
    font-family: 'Raleway', sans-serif;
    transition: all 0.3s ease;
}

.whatsapp-button:hover {
    background-color: #128C7E;
}

/* Adjust button for mobile devices */
@media (max-width: 600px) {
    .whatsapp-button {
        font-size: 14px;
        padding: 8px 12px;
        bottom: 10px;
        right: 10px;
    }
}

/* For very small screens, make the button circular and use an icon */
@media (max-width: 400px) {
    .whatsapp-button {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
    }
    .whatsapp-button::before {
        content: "\1F4AC"; /* Unicode for speech bubble emoji */
    }
    .whatsapp-button span {
        display: none;
    }
}

/* Order summary specific styles */
.order-summary .info-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.order-summary .info-section:last-child {
    border-bottom: none;
}

.order-summary .info-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.order-summary .info-group label {
    font-weight: bold;
    width: 60%;
    text-align: left;
}

.order-summary .info-group .info-box,
.order-summary .info-group strong {
    width: 40%;
    text-align: right;
}

.order-summary #map {
    height: 200px;
    width: 100%;
    margin-top: 20px;
    border-radius: 8px;
    overflow: hidden;
}

.order-summary .btn {
    margin-top: 20px;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .order-summary .info-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .order-summary .info-group label,
    .order-summary .info-group .info-box,
    .order-summary .info-group strong {
        width: 100%;
        text-align: left;
    }

    .order-summary .info-group .info-box,
    .order-summary .info-group strong {
        margin-top: 5px;
    }
}

.info-group {
    margin-bottom: 15px;
}

.info-group label {
    display: block;
    margin-bottom: 5px;
}

.info-box {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
}

.geolocation-btn {
    margin-top: 10px;
    font-weight: normal;
}

select#delivery_date {
    width: 100%;
    padding: 10px 15px;
    font-size: 1em;
    border: 1px solid #ced4da;
    border-radius: 8px;
    background-color: white;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23333' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 35px;
}

select#delivery_date:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(20, 33, 61, 0.2);
}

.error-card {
    background-color: #FFF5F5;
    border: 1px solid #FED7D7;
    color: #E53E3E;
    padding: 1rem;
    margin-top: 1rem;
    border-radius: 0.5rem;
    text-align: center;
}

.submit-btn[disabled] {
    background-color: #E2E8F0;
    cursor: not-allowed;
    opacity: 0.7;
}

.quantity-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

select[disabled] {
    background-color: #E2E8F0;
    cursor: not-allowed;
}

/* Invoice styles */
@page {
    size: letter;
    margin: 0;
}

.invoice-container {
    max-width: 800px;
    width: 100%;
    min-height: 11in;
    margin: 0 auto;
    padding: var(--spacing-large, 40px);
    background-color: white;
    box-sizing: border-box;
    position: relative;
}

/* Logo section */
.invoice-logo-section {
    text-align: center;
    margin-bottom: var(--spacing-large, 40px);
}

.invoice-logo {
    width: 120px;
    height: auto;
    margin: 0 auto;
    display: block;
}

/* Invoice title section */
.invoice-title-section {
    text-align: center;
    margin-bottom: var(--spacing-large, 40px);
}

.invoice-title-section h2 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-small, 10px);
}

.invoice-info {
    color: var(--text-color);
    font-size: 0.9em;
}

.invoice-info p {
    margin: 5px 0;
}

/* Contact info section */
.contact-info-section {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-large, 40px);
    gap: var(--spacing-large, 40px);
}

.company-info, .customer-info {
    flex: 1;
}

.company-info {
    text-align: left;
}

.customer-info {
    text-align: right;
}

.company-info h3, .customer-info h3 {
    color: var(--text-color);
    margin-bottom: var(--spacing-small, 10px);
    font-size: 1.1em;
}

.company-info p, .customer-info p {
    color: var(--text-muted);
    margin: 5px 0;
    font-size: 0.9em;
}

/* Items section */
.invoice-items {
    margin-bottom: var(--spacing-large, 40px);
}

.info-card {
    background-color: var(--secondary-color);
    padding: var(--spacing-medium, 20px);
    border-radius: 5px;
    margin-top: var(--spacing-small, 10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-label {
    font-weight: bold;
    color: var(--text-color);
}

.info-value {
    color: var(--text-color);
}

/* Total amount section */
.invoice-total {
    text-align: right;
    margin-top: var(--spacing-medium, 20px);
}

/* Footer */
footer {
    margin-top: 20px;
    padding: 20px 0;
    text-align: center;
}

footer p {
    margin-bottom: 20px;  /* Add space below the copyright text */
    color: var(--text-color);
    font-size: 0.8em;
}

.continue-btn {
    margin-top: 30px;  /* Add space above the button */
    margin-bottom: 20px;  /* Add space below the button */
    font-family: 'Raleway', sans-serif;
    font-size: 0.8em;
    padding: 15px;
    width: 100%;
    max-width: 300px;
    border: none;
    border-radius: 8px;
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Print-specific styles */
@media print {
    body {
        margin: 0;
        padding: 0;
        background: none;
    }
    
    .invoice-container {
        margin: 0;
        padding: 40px;
        box-shadow: none;
        min-height: 100vh;
    }
    
    .whatsapp-button {
        display: none;
    }
}

/* Items table styling */
.items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--spacing-large, 40px);
    background-color: var(--secondary-color);
    border-radius: 5px;
    overflow: hidden;
}

.items-table th,
.items-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.items-table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: normal;
}

.items-table td.price {
    text-align: right;
}

.items-table tbody tr:last-child td {
    border-bottom: none;
}

/* Total breakdown styling */
.invoice-totals {
    width: 300px;
    margin-left: auto;
    margin-bottom: var(--spacing-large, 40px);
}

.total-line {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.total-line:last-child {
    border-bottom: none;
}

.final-total {
    font-weight: bold;
    font-size: 1.1em;
    border-top: 2px solid #333;
    margin-top: 10px;
    padding-top: 15px;
}

/* Ensure table responsiveness */
@media (max-width: 600px) {
    .items-table {
        font-size: 0.9em;
    }
    
    .items-table th,
    .items-table td {
        padding: 10px;
    }
    
    .invoice-totals {
        width: 100%;
    }
}

/* Update input field styling */
.info-group input[type="text"], 
.info-group input[type="tel"] {
    width: 100%;
    box-sizing: border-box;
    display: block;
    padding: 15px;
    margin: 10px 0;
    border: 1px solid var(--input-border-color);
    border-radius: 8px;
}

button[type="submit"], button {
    font-family: 'Raleway', sans-serif;
    font-size: 0.8em;
    padding: 15px;
    margin: 10px 0;
    width: 100%;
    max-width: 300px;  /* Match other buttons */
    border: none;
    border-radius: 8px;
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    margin: 0 auto;  /* Center the button */
}

button[type="submit"]:hover, button:hover {
    background-color: var(--primary-color-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* --- Product Row Layout Overrides for Invoice Form --- */
#productsBody .product-row {
    border-bottom: 1px solid #eee;
    padding: 1rem 0 0.5rem 0;
    margin-bottom: 0.5rem;
}
#productsBody .product-col {
    min-width: 120px;
    margin-bottom: 0.5rem;
}
#productsBody .product-details-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-end;
}
#productsBody .product-col-small {
    min-width: 90px;
    flex: 0 0 90px;
}
#productsBody .product-label {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 0.2rem;
}
#productsBody .product-subtotal {
    min-width: 70px;
    text-align: right;
}
#productsBody .subtotal-value {
    font-weight: bold;
    font-size: 1.1em;
}
#productsBody .remove-btn {
    min-width: 40px;
    text-align: right;
}
#productsBody .product-row input[type="text"],
#productsBody .product-row input[type="number"] {
    width: auto !important;
    min-width: 60px;
    display: inline-block;
    margin: 0;
}
@media (max-width: 700px) {
    #productsBody .product-details-row {
        flex-direction: column;
        gap: 0.2rem;
    }
    #productsBody .product-col-small,
    #productsBody .product-subtotal,
    #productsBody .remove-btn {
        min-width: 0;
        width: 100%;
        text-align: left;
    }
}

#productsBody .product-row-vertical {
    border-bottom: 1px solid #eee;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    background: #fafaf9;
    border-radius: 8px;
    padding-top: 1rem;
}
#productsBody .form-group label {
    font-weight: 500;
    color: #333;
}
#productsBody .subtotal-value {
    font-size: 1.1em;
    color: #222;
}
#productsBody .btn-danger {
    width: 100%;
    margin-top: 0.5rem;
}

