html {
    font-size: 100%;
}

:root {
    --color-cakephp-red: #d33c43;
    --color-cakephp-gray: #404041;
    --color-cakephp-blue: #2f85ae;
    --color-cakephp-lightblue: #34bdd7;
    --color-lightgray: #606c76;
    --color-white: #fff;
    --color-main-bg: #f5f7fa;
    --color-links: #786c3b;
    --color-links-active: #5a5029;
    --color-headings: #1c1c1a;
    --color-message-success-bg: #e3fcec;
    --color-message-success-text: #1f9d55;
    --color-message-success-border: #51d88a;
    --color-message-warning-bg: #fffabc;
    --color-message-warning-text: #8d7b00;
    --color-message-warning-border: #d3b800;
    --color-message-error-bg: #fcebea;
    --color-message-error-text: #cc1f1a;
    --color-message-error-border: #ef5753;
    --color-message-info-bg: #eff8ff;
    --color-message-info-text: #2779bd;
    --color-message-info-border: #6cb2eb;
    --beige: #dad7c5;
    --beige-light: #f0ede4;
    --sage: #bce3c5;
    --earth-yellow: #e1a95e;
    --oakwood: #786c3b;
    --oakwood-dark: #5a5029;

    --font-display: 'Raleway', 'Helvetica Neue', sans-serif;
    --font-body: 'Raleway', 'Helvetica Neue', sans-serif;
    --font-admin: Arial, 'Helvetica Neue', Helvetica, sans-serif;
}

/* ===========================================
   Base styles
   =========================================== */

body {
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.65;
    background: var(--color-main-bg);
    color: #3d3d3a;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

:not(.admin-wrapper) h1,
:not(.admin-wrapper) h2,
:not(.admin-wrapper) h3,
:not(.admin-wrapper) h4,
:not(.admin-wrapper) h5,
:not(.admin-wrapper) h6 {
    font-family: var(--font-display);
    font-weight: 400;
    color: var(--color-headings);
    letter-spacing: 0.01em;
}

a {
    color: var(--color-links);
    transition: color 0.2s linear;
}

a:hover, a:focus, a:active {
    color: var(--color-links-active);
    transition: color 0.2s ease-out;
}

/* btn-new-product needs white text regardless of state */
a.btn-new-product,
a.btn-new-product:link,
a.btn-new-product:visited,
a.btn-new-product:hover,
a.btn-new-product:focus,
a.btn-new-product:active {
    color: #fff !important;
    text-decoration: none !important;
}

th a, .actions a {
    color: var(--color-lightgray);
}

.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

th { white-space: nowrap; }

.content {
    padding: 2rem;
    background: var(--beige);
    border-radius: 0.4rem;
}

.content form { margin: 0; }

.actions a {
    font-weight: bold;
    padding: 0 0.4rem;
}

.actions a:first-child { padding-left: 0; }

main > .row { margin-bottom: 4rem; }
.register .row { margin-bottom: 0; }

/* ===========================================
   Navbar
   =========================================== */

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2.5rem;
    height: 78px;
    background: #ffffff;
    border-bottom: 1px solid rgba(120, 108, 59, 0.14);
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.navbar-brand {
    min-width: 120px;
    display: flex;
    align-items: center;
}

.navbar-logo {
    height: 46px;
    width: auto;
    display: block;
}

.navbar-links {
    display: flex;
    gap: 0.2rem;
    align-items: center;
}

.navbar-links a {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.92rem;
    text-transform: uppercase;
    color: #2a2a26;
    text-decoration: none;
    padding: 0.45rem 1rem;
    border-radius: 5px;
    transition: color 0.2s ease, background 0.2s ease;
}

.navbar-links a:hover {
    color: var(--oakwood);
    background: rgba(120, 108, 59, 0.07);
    text-decoration: none;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* ===========================================
   Navbar icon buttons (search, cart, user)
   =========================================== */

.nav-icon-btn {
    width: 42px;
    height: 42px;
    border: none;
    background: transparent;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #2a2a26;
    transition: background 0.18s ease, color 0.18s ease;
    position: relative;
    text-decoration: none;
}

.nav-icon-btn:hover {
    background: rgba(120, 108, 59, 0.09);
    color: var(--oakwood);
}

.nav-icon-btn svg {
    display: block;
    flex-shrink: 0;
}

/* Cart wraps an <a> tag so it needs position:relative for the badge */
.nav-cart-wrap {
    position: relative;
}

.nav-cart-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 15px;
    height: 15px;
    background: var(--oakwood);
    color: #fff;
    border-radius: 50%;
    font-size: 9px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    line-height: 1;
}

/* ===========================================
   Account dropdown
   =========================================== */

.nav-dropdown-wrap {
    position: relative;
}

.nav-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: #fff;
    border: 0.5px solid rgba(120, 108, 59, 0.2);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.09);
    min-width: 160px;
    overflow: hidden;
    z-index: 999;
}

.nav-dropdown.open {
    display: block;
}

.nav-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.65rem 1.1rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #2a2a26;
    text-decoration: none;
    transition: background 0.15s;
}

.nav-dropdown a:hover {
    background: rgba(120, 108, 59, 0.07);
    color: var(--oakwood);
}

.nav-dropdown a svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.nav-dropdown-label {
    display: block;
    padding: 0.5rem 1.1rem 0.2rem;
    font-family: var(--font-body);
    font-size: 0.76rem;
    color: #999;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.nav-dropdown-divider {
    height: 0.5px;
    background: rgba(120, 108, 59, 0.14);
    margin: 2px 0;
}

.nav-dropdown-danger {
    color: #b23b3b !important;
}

.nav-dropdown-danger:hover {
    background: rgba(178, 59, 59, 0.06) !important;
    color: #b23b3b !important;
}

/* ===========================================
   Flash messages
   =========================================== */

.message {
    padding: 0.7rem 1.1rem;
    margin-bottom: 1rem;
    cursor: pointer;
    border: 1px solid;
    border-radius: 7px;
    font-size: 0.9rem;
    font-family: var(--font-body);
    background: var(--color-message-info-bg);
    color: var(--color-message-info-text);
    border-color: var(--color-message-info-border);
}

.message.hidden { display: none; }

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

.message.warning {
    background: var(--color-message-warning-bg);
    color: var(--color-message-warning-text);
    border-color: var(--color-message-warning-border);
}

.message.error {
    background: var(--color-message-error-bg);
    color: var(--color-message-error-text);
    border-color: var(--color-message-error-border);
}

/* ===========================================
   Forms
   =========================================== */

.input { margin-bottom: 1.5rem; }
.input input, .input select, .input textarea { margin-bottom: 0; }

.input label:has(input[type='checkbox']),
.input label:has(input[type='radio']) {
    display: flex;
    align-items: center;
}

.input label:has(~ label),
.input label:has(input[type='radio']) { margin-bottom: 0; }

.input label > input[type='checkbox'],
.input label > input[type='radio'] { margin-right: 1rem; }

input[type='color'] {
    max-width: 4rem;
    padding: 0.3rem 0.5rem;
}

.error-message { color: var(--color-message-error-text); }

/* ===========================================
   Pagination
   =========================================== */

.paginator { text-align: right; }
.paginator p { margin-bottom: 0; }

.pagination {
    display: flex;
    justify-content: center;
    list-style: none;
    margin: 0 0 1rem 0;
    padding: 0;
}

.pagination li {
    display: inline-block;
    margin: 0.25em;
    text-align: center;
}

.pagination a {
    display: inline-block;
    min-width: 3rem;
    padding: 0;
    position: relative;
    color: var(--color-cakephp-blue);
    font-size: 1.25rem;
    line-height: 3rem;
    text-decoration: none;
    transition: background 0.3s, color 0.3s;
}

.pagination li.active a,
.pagination a:hover { text-decoration: underline; }

.pagination .disabled a {
    cursor: not-allowed;
    color: var(--color-lightgray);
    text-decoration: none;
}

.first a, .prev a, .next a, .last a { padding: 0 0.75rem; }
.disabled a:hover { background: initial; color: initial; }
.asc:after { content: " \2193"; }
.desc:after { content: " \2191"; }

/* ===========================================
   Error page
   =========================================== */

.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

/* ===========================================
   Footer
   =========================================== */

.footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-direction: row;
    gap: 2rem;
    padding: 3.5rem 4rem;
    background-color: var(--oakwood);
    color: var(--beige-light);
}

.footer-brand h3 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    margin-bottom: 1rem;
    color: #fff;
}

.footer-brand p {
    font-family: var(--font-body);
    margin-bottom: 0.4rem;
    color: rgba(240, 237, 228, 0.76);
    font-size: 0.84rem;
    font-weight: 300;
    letter-spacing: 0.02em;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    text-align: right;
}

.footer-links a {
    font-family: var(--font-body);
    color: rgba(217, 212, 196, 0.75);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    transition: color 0.2s ease;
}

.footer-links a:hover { color: #fff; }

@media (max-width: 768px) {
    .navbar { padding: 0 1.2rem; }
    .footer { flex-direction: column; padding: 2.5rem 1.5rem; }
    .footer-links { text-align: left; }
}

.view.content .text { margin-top: 1.2rem; }
.related { margin-top: 2rem; }

/* ===========================================
   Admin panel overrides
   =========================================== */

.admin-wrapper,
.admin-wrapper * {
    font-family: var(--font-admin) !important;
}

.admin-wrapper h1 { font-size: 1.7rem !important; font-weight: 700; letter-spacing: -0.03em; color: #111827; margin: 0; }
.admin-wrapper h2 { font-size: 1.4rem !important; font-weight: 700; letter-spacing: -0.02em; color: #111827; }
.admin-wrapper h3 { font-size: 1rem !important;   font-weight: 600; letter-spacing: -0.01em; color: #111827; margin-bottom: 0.5rem; }
.admin-wrapper h4 { font-size: 0.9rem !important; font-weight: 600; color: #374151; }
.admin-wrapper h5,
.admin-wrapper h6 { font-size: 0.82rem !important; font-weight: 600; color: #374151; }
