/* cart.css */

/* Global box-sizing for better layout control */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Body styles */
body {
    font-family: Arial, sans-serif;
    background-color: #f9f9f9;
    padding: 20px;
    color: #333;
}

/* Page heading */
h1 {
    color: #333;
    text-align: center;
    margin-bottom: 30px;
}

/* Table styles */
table {
    width: 80%;
    margin: 0 auto 30px auto;
    border-collapse: collapse;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

/* Table header */
th {
    background-color: #eee;
    border-bottom: 2px solid #ddd;
    padding: 12px;
    text-align: left;
}

/* Alternate row coloring */
tr:nth-child(even) {
    background-color: #f2f2f2;
}

/* Table cells */
td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
    text-align: left;
    vertical-align: middle;
}

/* Quantity input field */
input[type="number"] {
    width: 60px;
    padding: 6px 8px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Input focus effect */
input[type="number"]:focus {
    border-color: #008CBA;
    outline: none;
    box-shadow: 0 0 5px rgba(0, 140, 186, 0.5);
}

/* General button styling */
button {
    padding: 10px 20px;
    font-size: 16px;
    background-color: #008CBA;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

/* Button hover effect */
button:hover {
    background-color: #005f73;
}

/* Remove button specific style */
button.remove-button,
button.btn-remove {
    background-color: #d9534f;
}

/* Remove button hover */
button.remove-button:hover,
button.btn-remove:hover {
    background-color: #b52b27;
}

/* Remove extra margin on buttons inside table cells */
td button {
    margin-right: 5px;
}

/* Style edit link as button */
a.btn-edit {
    display: inline-block;
    padding: 10px 20px;
    background-color: #008CBA; /* same blue as other buttons */
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-right: 5px;
}

/* Edit button hover */
a.btn-edit:hover {
    background-color: #005f73;
}

/* Anchor tags reset */
a {
    text-decoration: none;
}

/* Buttons inside anchor tags */
a button {
    display: block;
    margin: 0 auto;
    min-width: 180px;
}

/* Paragraph styling */
p {
    text-align: center;
    font-size: 1.1rem;
}

/* Responsive Styles for smaller screens */
@media (max-width: 768px) {
    /* Make table elements block for stacking */
    table, thead, tbody, th, td, tr {
        display: block;
    }

    /* Hide table headers */
    thead tr {
        display: none;
    }

    /* Style rows as cards */
    tbody tr {
        margin-bottom: 20px;
        background: #fff;
        box-shadow: 0 1px 6px rgba(0,0,0,0.1);
        border-radius: 8px;
        padding: 15px;
    }

    /* Table cells stack and get labels from data-label attribute */
    tbody td {
        position: relative;
        padding-left: 50%;
        border: none;
        border-bottom: 1px solid #ddd;
        text-align: left;
    }

    /* Label for each cell */
    tbody td::before {
        position: absolute;
        top: 15px;
        left: 15px;
        width: 45%;
        white-space: nowrap;
        font-weight: 600;
        color: #555;
        content: attr(data-label);
    }

    /* Quantity input full width */
    input[type="number"] {
        width: 100%;
        margin-top: 5px;
    }

    /* Buttons full width and stacked */
    button, a button {
        width: 100%;
        margin-top: 10px;
        min-width: unset;
    }
}

/* Order Summary Table */
table.order-summary {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

table.order-summary th,
table.order-summary td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

table.order-summary th {
    background-color: #f2f2f2;
}

@media (max-width: 600px) {
    input[type="text"],
    textarea {
        width: 100%;
    }

    table.order-summary {
        font-size: 0.9rem;
    }
}

/* Checkout container layout */
.checkout-container {
    display: flex;
    gap: 40px;
    max-width: 1200px;
    margin: 40px auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    align-items: flex-start;
}

/* Sections inside checkout */
.order-summary-section,
.shipping-form {
    flex: 1;
}

/* Divider line between sections */
.vertical-divider {
    width: 1px;
    background-color: #ccc;
    height: auto;
    align-self: stretch;
}

/* Order Summary Table inside section */
.order-summary {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.order-summary th,
.order-summary td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #ddd;
}

.order-summary th {
    background-color: #f4f4f4;
}

.order-summary tr:nth-child(even) {
    background-color: #fafafa;
}

/* Shipping Form styles */
.shipping-form .form-group {
    margin-bottom: 20px;
}

.shipping-form label {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
}

.shipping-form input,
.shipping-form textarea {
    width: 100%;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
}

.shipping-form button {
    padding: 12px 24px;
    background-color: #008CBA;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.shipping-form button:hover {
    background-color: #005f73;
}

/* Responsive layout for checkout container */
@media (max-width: 768px) {
    .checkout-container {
        flex-direction: column;
    }

    .vertical-divider {
        display: none;
    }
}

/* Home icon link style */
.home-icon {
    text-decoration: none;
    font-weight: bold;
    color: #2c3e50;
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.home-icon:hover {
    color: #008CBA;
    cursor: pointer;
}

/* Make Actions column narrower and center content */
table th:nth-child(5),
table td:nth-child(5) {
    width: 250px; /* Adjust as needed */
    white-space: nowrap; /* Prevent wrapping */
    text-align: center;
}

/* Center buttons in Actions column with flexbox */
table td:nth-child(5) {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Make all buttons in table cells uniform */
table button {
    padding: 8px 16px;
    font-size: 14px;
    min-width: 100px; /* Optional: same width */
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* Specific color for Remove buttons using inline style selector */
table button[style*="background-color: red"] {
    background-color: red;
    color: white;
}

/* Optional hover effect */
table button:hover {
    opacity: 0.9;
}
form.inline {
    display: inline;
}
/* Align Price column in admin products table */
.admin-products th:nth-child(3),
.admin-products td:nth-child(3) {
    text-align: right;
}
.admin-products th:nth-child(4),
.admin-products td:nth-child(4) {
    text-align: center;
}

/* Align columns in tbody except last row */
.cart-table tbody tr:not(:last-child) td:nth-child(1),
.cart-table thead th:nth-child(1) {
  text-align: left;
}

.cart-table tbody tr:not(:last-child) td:nth-child(2),
.cart-table thead th:nth-child(2),
.cart-table tbody tr:not(:last-child) td:nth-child(5),
.cart-table thead th:nth-child(5) {
  text-align: center;
}

.cart-table tbody tr:not(:last-child) td:nth-child(3),
.cart-table thead th:nth-child(3),
.cart-table tbody tr:not(:last-child) td:nth-child(4),
.cart-table thead th:nth-child(4) {
  text-align: right;
}

/* Last row alignment (only tbody cells) */
.cart-table tbody tr:last-child td:nth-child(1),
.cart-table tbody tr:last-child td:nth-child(2) {
  text-align: right;
}

.cart-table tbody tr:last-child td:nth-child(3) {
  text-align: center;
}

/* Align Order Summary Table columns */

/* Header alignment */
.order-summary th:nth-child(2) {
  text-align: center;
}

.order-summary th:nth-child(3),
.order-summary th:nth-child(4) {
  text-align: right;
}

/* Body alignment */
.order-summary td:nth-child(2) {
  text-align: center;
}

.order-summary td:nth-child(3),
.order-summary td:nth-child(4) {
  text-align: right;
}

/* Last row: right align last column */
.order-summary tbody tr:last-child td:last-child {
  text-align: right;
}
