/* Milligram overrides */
:root {
    /* The following are official CakePHP colors */
    --color-cakephp-red: #d33c43;
    --color-cakephp-gray: #404041;
    --color-cakephp-blue: #2f85ae;
    --color-cakephp-lightblue: #34bdd7;

    /* These are additional colors */
    --color-lightgray: #606c76;
    --color-white: #fff;

    --color-main-bg: #f5f7fa;
    --color-links: var(--color-cakephp-blue);
    --color-links-active: #2a6496;
    --color-headings: #363637;

    --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;
}

.button, button, input[type='button'], input[type='reset'], input[type='submit'] {
    background-color: var(--color-cakephp-red);
    border-color: var(--color-cakephp-red);
}

body {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-weight: 400;
    background: var(--color-main-bg);
}

.top-nav-links,
.side-nav,
h1, h2, h3, h4, h5, h6 {
    font-family: "Raleway", sans-serif;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 400;
    color: var(--color-headings);
}

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;
}

.side-nav a,
.top-nav-links a,
th a,
.actions a {
    color: var(--color-lightgray);
}

.side-nav a:hover,
.side-nav a:focus,
.actions a:hover,
.actions a:focus {
    color: var(--color-links-active);
}

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

/* Main */
.content {
    padding: 2rem;
    background: var(--color-white);
    border-radius: 0.4rem;
    /* Thanks Stripe */
    box-shadow: 0 7px 14px 0 rgba(60, 66, 87, 0.1),
        0 3px 6px 0 rgba(0, 0, 0, 0.07);
}
.content form {
    margin: 0;
}
.actions a {
    font-weight: bold;
    padding: 0 0.4rem;
}
.actions a:first-child {
    padding-left: 0;
}
th {
    white-space: nowrap;
}

/* Nav bar */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 112rem;
    padding: 2rem;
    margin: 0 auto;
}
.top-nav-title a {
    font-size: 2.4rem;
    color: var(--color-cakephp-red);
}
.top-nav-title span {
    color: var(--color-cakephp-gray);
}
.top-nav-links a {
    margin: 0 0.5rem;
}
.top-nav-title a,
.top-nav-links a {
    font-weight: bold;
}
.side-nav-item {
    display: block;
    padding: 0.5rem 0;
}

/* ========================================
   Hamburger Menu Styles
   ======================================== */

/* Hide checkbox input */
.nav-toggle {
    display: none;
}

/* Desktop: hide hamburger, show menu normally */
.nav-toggle-label {
    display: none;
}

/* Mobile styles */
@media screen and (max-width: 640px) {
    /* Show hamburger icon */
    .nav-toggle-label {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 6px;
        width: 30px;
        cursor: pointer;
        position: absolute;
        top: 1.5rem;
        right: 1rem;
        z-index: 1000;
    }

    /* Hamburger bars */
    .nav-toggle-label span {
        display: block;
        height: 3px;
        width: 100%;
        background: var(--pico-contrast);
        border-radius: 2px;
        margin-bottom: 5px;
        transition: all 0.3s ease;
    }

    .nav-toggle-label span:last-child {
        margin-bottom: 0;
    }

    /* Hide menu by default on mobile */
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--pico-background-color);
        border-top: 1px solid var(--pico-muted-border-color);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        z-index: 999;
    }

    /* Show menu when checkbox is checked */
    .nav-toggle:checked ~ .nav-menu {
        display: block;
    }

    /* Stack menu items vertically */
    .nav-menu li {
        display: block;
        text-align: left;
        padding: 0;
    }

    .nav-menu li a {
        display: block;
        padding: 1rem 1.5rem;
        border-bottom: 1px solid var(--pico-muted-border-color);
    }

    .nav-menu li:last-child a {
        border-bottom: none;
    }

    /* Animate hamburger to X when open */
    .nav-toggle:checked ~ .nav-toggle-label span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .nav-toggle:checked ~ .nav-toggle-label span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle:checked ~ .nav-toggle-label span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    /* Ensure nav container has relative positioning */
    nav {
        position: relative;
    }
}

/* View action */
.view.content .text {
    margin-top: 1.2rem;
}
.related {
    margin-top: 2rem;
}

/* Flash Messages - Enhanced Styling */
.message {
    position: relative;
    padding: 1rem 1rem 1rem 3rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    border-left: 4px solid;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 0.95rem;
    line-height: 1.5;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: slideInDown 0.4s ease-out;
}

.message:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.message::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    font-weight: bold;
}

/* Success Messages */
.message.success {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f4 100%);
    color: #2e7d32;
    border-left-color: #4caf50;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

.message.success::before {
    content: '✓';
    color: #4caf50;
}

.message.success:hover {
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

/* Error Messages */
.message.error {
    background: linear-gradient(135deg, #ffebee 0%, #fef5f5 100%);
    color: #c62828;
    border-left-color: #f44336;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.2);
}

.message.error::before {
    content: '✗';
    color: #f44336;
}

.message.error:hover {
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

/* Warning Messages */
.message.warning {
    background: linear-gradient(135deg, #fff8e1 0%, #fffbf0 100%);
    color: #f57c00;
    border-left-color: #ff9800;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.2);
}

.message.warning::before {
    content: '⚠';
    color: #ff9800;
}

.message.warning:hover {
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

/* Info Messages */
.message.info,
.message:not(.success):not(.error):not(.warning) {
    background: linear-gradient(135deg, #e3f2fd 0%, #f0f7ff 100%);
    color: #1565c0;
    border-left-color: #2196f3;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
}

.message.info::before,
.message:not(.success):not(.error):not(.warning)::before {
    content: 'ℹ';
    color: #2196f3;
}

.message.info:hover,
.message:not(.success):not(.error):not(.warning):hover {
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

/* Hidden state for dismissal */
.message.hidden {
    opacity: 0;
    transform: translateY(-10px);
    max-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Animations */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade out animation */
.message.fading {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* 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: 1.0rem;
}
input[type='color'] {
    max-width: 4rem;
    padding: 0.3rem .5rem 0.3rem;
}
.error-message {
    color: var(--color-message-error-text);
}

/* Paginator */
.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 {
    color: var(--color-cakephp-blue);
    display: inline-block;
    font-size: 1.25rem;
    line-height: 3rem;
    min-width: 3rem;
    padding: 0;
    position: relative;
    text-decoration: none;
    transition: background .3s,color .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 .75rem;
}
.disabled a:hover {
    background: initial;
    color: initial;
}
.asc:after {
    content: " \2193";
}
.desc:after {
    content: " \2191";
}

/* Error in non debug mode */
.error-container {
    align-items: center;
    display: flex;
    flex-direction: column;
    height: 100vh;
    justify-content: center;
}

@media screen and (max-width: 640px) {
    /* Fix milligram not having a responsive column system */
    .row .column[class*='column-'] {
        flex: 0 0 100%;
        max-width: 100%
    }
    .top-nav {
        margin: 0 auto;
    }
    .side-nav {
        margin-bottom: 1rem;
    }
    .heading {
        margin-bottom: 1rem;
    }
    .side-nav-item {
        display: inline;
        margin: 0 1.5rem 0 0;
    }
    .asc:after {
        content: " \2192";
    }
    .desc:after {
        content: " \2190";
    }
}
