/* ==================================================
   Global theme + utilities
================================================== */

:root {
    --brand-color: #6C1319;
    --brand-color-dark: #5a0f15;
    --border-color: #dee2e6;
    --muted: #666;
}

/* Brand helpers */
.bg-brand {
    background-color: var(--brand-color) !important;
}

.btn-brand {
    background-color: var(--brand-color);
    color: #fff;
}

.btn-brand:hover {
    background-color: var(--brand-color-dark);
    color: #fff;
}

/* Global touch-friendly buttons */
.btn {
    min-height: 44px;
}

/* ==================================================
   Admin layout
================================================== */

.admin-layout {
    display: flex;
    min-height: calc(100vh - 56px);
}

.admin-content {
    flex: 1;
    padding: 1.25rem;
}

@media (min-width: 992px) {
    #adminSidebar {
        width: 240px;
        flex: 0 0 240px;
        height: calc(100vh - 56px);
        overflow-y: auto;
    }
}

/* ==================================================
   Product cards
================================================== */

.product-card-img {
    height: 120px;
    object-fit: contain;
    background: #fff;
}

@media (min-width: 576px) {
    .product-card-img {
        height: 160px;
    }
}

/* ==================================================
   Icon buttons
================================================== */

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-icon svg {
    display: block;
    width: 16px;
    height: 16px;
    fill: currentColor !important;
}

.btn-outline-secondary.btn-icon {
    color: #6c757d;
}

.btn-outline-danger.btn-icon {
    color: #dc3545;
}

.btn-outline-secondary.btn-icon:hover,
.btn-outline-danger.btn-icon:hover {
    color: #fff;
}

/* ==================================================
   Cart quantity controls
================================================== */

.cart-qty-input {
    width: 72px;
    min-width: 72px;
    text-align: center;
}

.cart-qty-control {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.cart-qty-control .btn {
    width: 34px;
    height: 34px;
    padding: 0;
    font-size: 1.1rem;
    line-height: 1;
}

.cart-qty-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.cart-qty-row .btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
}

.cart-qty-error {
    width: 100%;
    font-size: 0.75rem;
    color: #dc3545;
    margin-top: 0.25rem;
}

.cart-qty-row.error {
    animation: shake 0.2s linear 2;
}

.qty-plus[disabled] {
    opacity: 0.4;
    pointer-events: none;
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    50% { transform: translateX(3px); }
    75% { transform: translateX(-3px); }
    100% { transform: translateX(0); }
}

/* ==================================================
   Cart mobile table-to-card layout
================================================== */

@media (max-width: 767.98px) {

    .table-responsive thead {
        display: none;
    }

    .table-responsive table,
    .table-responsive tbody,
    .table-responsive tr,
    .table-responsive td {
        display: block;
        width: 100%;
    }

    .table-responsive tr {
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 0.85rem;
        margin-bottom: 1rem;
        background: #fff;
        box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    }

    .table-responsive td {
        border: none;
        padding: 0.45rem 0;
        display: grid;
        grid-template-columns: 120px 1fr;
        gap: 0.75rem;
        align-items: start;
        text-align: left !important;
    }

    .table-responsive td::before {
        content: attr(data-label);
        font-size: 0.72rem;
        font-weight: 600;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: 0.03em;
        padding-top: 0.1rem;
    }

    .table-responsive td[data-label="Product"] a {
        font-weight: 600;
        text-decoration: none;
    }

    .table-responsive td[data-label="Product"] a:hover {
        text-decoration: underline;
    }

    .table-responsive td[data-label^="Line"] {
        font-weight: 700;
    }

    .table-responsive td[data-label="Quantity"] {
        align-items: center;
    }

    .cart-qty-form {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex-wrap: nowrap;
    }

    .cart-qty-form .btn-icon {
        width: 36px;
        height: 36px;
        padding: 0.35rem;
    }

    .cart-qty-input {
        width: 78px;
        min-width: 78px;
    }

    .table-responsive td[data-label="Action"] {
        display: none;
    }
}

/* ==================================================
   Driver portal mobile fixes
================================================== */

@media (max-width: 576px) {
    .card {
        margin-left: 0;
        margin-right: 0;
    }
}

/* ==================================================
   Customer authentication pages
   Used by login.php, register.php, verify.php, forgot/reset pages
================================================== */

.auth-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(255,255,255,0.35), transparent 30%),
        linear-gradient(135deg, #ff6b6b, #ff9f43, #feca57);
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 430px;
    border: 0;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 18px 45px rgba(0,0,0,0.22);
}

.auth-header {
    background: linear-gradient(135deg, #198754, #20c997);
    color: #fff;
    padding: 28px 24px;
    text-align: center;
}

.auth-logo {
    width: 84px;
    height: 84px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 32px;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.35);
}

.auth-logo-img {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.login-brand-logo {
    height: 90px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
}

.auth-title {
    font-size: 1.55rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.auth-subtitle {
    font-size: 0.95rem;
    opacity: 0.95;
    margin: 0;
}

.auth-content {
    padding: 28px;
    background: #fff;
}

.auth-content .form-label {
    font-weight: 600;
    color: #333;
}

.auth-content .form-control {
    height: 52px;
    border-radius: 14px;
    border: 1px solid #e1e1e1;
}

.auth-content .form-control:focus {
    border-color: #20c997;
    box-shadow: 0 0 0 4px rgba(32,201,151,0.18);
}

.auth-content .alert-info {
    background: #e8f7ff;
    border-color: #b6e0ff;
    color: #055160;
}

.auth-content input[name="code"] {
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 8px;
    font-weight: 700;
}

.auth-card .alert {
    border-radius: 14px;
}

.btn-auth {
    height: 52px;
    border-radius: 14px;
    border: 0;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #198754, #20c997);
    box-shadow: 0 8px 18px rgba(25,135,84,0.28);
}

.btn-auth:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(25,135,84,0.35);
}

.auth-link {
    color: #198754;
    font-weight: 600;
}

.auth-link:hover {
    color: #146c43;
}

.auth-box {
    margin-top: 20px;
    padding: 14px;
    border-radius: 14px;
    background: #fff8e7;
    text-align: center;
    border: 1px solid #ffe2a8;
}

.auth-box a {
    font-weight: 700;
    color: #d35400;
    text-decoration: none;
}

.auth-box a:hover {
    text-decoration: underline;
}

@media (max-width: 576px) {

    .auth-wrapper {
        padding: 15px;
    }

    .auth-content {
        padding: 20px;
    }

    .auth-title {
        font-size: 1.35rem;
    }

    .auth-logo {
        width: 56px;
        height: 56px;
        font-size: 28px;
    }

    .login-brand-logo {
        height: 70px;
        max-width: 150px;
    }
}

/* ==================================================
   Homepage search banner
================================================== */

.search-brand-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.search-brand-logo {
    height: 84px;
    width: auto;
    object-fit: contain;
}

.search-title {
    margin-bottom: 16px !important;
}

.title-main {
    line-height: 1;
}

.title-sub {
    margin-top: 5px;
}

.search-filters {
    display: flex;
    justify-content: center;
    gap: 14px;
    max-width: 1100px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.search-field {
    flex: 1;
    min-width: 260px;
    max-width: 360px;
}

.search-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
}

.search-actions .btn,
.search-actions .search-btn,
.search-actions .clear-btn {
    min-width: 140px;
    height: 50px;
}

@media (min-width: 992px) {
    .search-actions {
        width: 100%;
    }
}

@media (max-width: 768px) {

    .search-filters {
        display: block;
    }

    .search-field {
        max-width: 100%;
        margin-bottom: 12px;
    }

    .search-actions {
        display: flex;
        gap: 10px;
    }

    .search-actions .btn {
        flex: 1;
        min-width: auto;
    }
}

@media (max-width: 576px) {

    .search-brand-logo {
        height: 44px;
    }

    .search-brand-line {
        gap: 10px;
    }

    .title-main {
        font-size: 1.7rem;
    }

    .title-sub {
        font-size: 0.8rem;
    }

    .search-actions .search-btn,
    .search-actions .clear-btn {
        flex: 1;
        min-width: 0;
    }
}