:root {
    --primary-color: #3EBE9B;
    --secondary-color: #1D4C71;
    --danger-color: #be3e61;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #eeeeee 100%);
    min-height: 100vh;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

span.rk-header {
    align-items: center;
    display: flex;
    height: 50px;
}

span.rk-header a {
    text-decoration: none;
}

span.rk-header img {
    height: 50px;
    width: 50px;
}

@font-face {
    font-family: "BebasNeue";
    font-weight: bold;
    src: url(/static/fonts/BebasNeue-Book.ttf);
}

span.rk-header span {
    font-family: "BebasNeue", sans-serif;
    font-weight: bold;
    font-size: 2em;
    margin-left: 10px;
}

#profile {
    float: right;
    padding-top: 10px;
}

nav ul {
    display: flex;
    list-style-type: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

nav ul li {
    padding-left: 5px;
    padding-right: 15px;
}

nav a {
    color: var(--secondary-color);
    transition: color 0.3s ease;
}

nav a:hover, nav a[aria-current="page"] {
    color: var(--primary-color);
}

section#dashboard div#onboarding {
    margin-bottom: 1rem;
}

section#dashboard div#onboarded {
    margin-top: 1rem;
}

#search-form {
    text-align: center;
    margin: 2rem 0;
}

#search-query {
    height: 2.5em;
    min-width: 100px;
    width: 70%;
    padding: 0 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#search-query:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(62, 190, 155, 0.3);
}

.recall-icon {
    text-align: center;
}

footer {
    text-align: center;
    margin-top: 2em;
    padding: 2em 1em;
    background: rgba(255, 255, 255, 0.8);
    border-top: 2px solid var(--primary-color);
    border-radius: 8px 8px 0 0;
}

footer table {
    margin: 0 auto;
}

footer td {
    padding: 0 1em;
}

.spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinner-div {
    text-align: center;
    margin: 1em 0;
}

#profile {
    font-size: 0.9em;
    color: var(--secondary-color);
}

.intro {
    margin-bottom: 2em;
    font-style: italic;
}

section#help article.card {
    margin-bottom: 1rem;
}

#preferences, #patterns {
    margin-bottom: 2em;
}

/* Dialog styling for recall modals */
dialog {
    max-width: 90vw;
    width: 800px;
    border: none;
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    outline: none;
    background: #fff;
}

dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.5);
}

dialog > form {
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

dialog > form > header {
    flex-shrink: 0;
}

dialog > form > div {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    outline: none;
    min-height: 0; /* Allow flex shrinking */
}

dialog > form > div > p {
    margin-top: 1em;
}

dialog > form > footer {
    flex-shrink: 0;
    padding: 1rem 1rem 1rem 1rem;
}

/* Modal backdrop */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* Add spacing from topnav to page headings */
main h2:first-child {
    margin-top: 2rem;
}

/* Preserve whitespace in recall descriptions */
.description, .recall-description {
    white-space: pre-wrap;
    line-height: 1.5;
    outline: none;
    border: none;
}

/* Search form layout */
.search-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.search-form input {
    flex: 1;
}

/* Settings form spacing */
#update-settings button {
    margin-top: 1rem;
}

/* Inventory search layout */
.inventory-search {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.inventory-search input {
    flex: 1;
    max-width: 70%;
}

/* Desktop: patterns buttons side by side */
#user-patterns .modify {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
}
#user-patterns .modify input, #user-patterns .modify button {
    /* Margins handled by flex gap */
}

#user-patterns .add-input {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.patterns-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.severity-block {
    margin-bottom: 1rem;
}

.severity-block h4 {
    margin-bottom: 0.5rem;
}

.severity-block table {
    width: 100%;
    border-collapse: collapse;
}

.severity-block th, .severity-block td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.severity-block .modify {
    text-align: right;
}

.add-input input {
    max-width: 70%;
    margin-right: 5%;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    /* Add padding to main content on mobile */
    main {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Hide details and URL columns on mobile for recall tables */
    .recall-table th:nth-child(1), .recall-table td:nth-child(1), /* Details */
    .recall-table th:nth-child(4), .recall-table td:nth-child(4) { /* URL */
        display: none;
    }

    /* Mobile table layout */
    table tr .recall-table {
        display: block;
    }
    table.settings-table tr {
        display: flex;
    }
    table tr {
        border-bottom: 1px solid #eee;
        padding: 1rem 0;
    }
    table th, table td {
        display: block;
        width: 100% !important;
        text-align: left;
        border: none;
        padding: 0.25rem 0;
    }
    table th {
        font-weight: bold;
        font-size: 0.9em;
        color: #666;
    }
    table td:nth-child(2) { /* Title */
        font-size: 1.1em;
        font-weight: bold;
        margin-bottom: 0.5rem;
    }
    table td:nth-child(3) { /* Description */
        margin-bottom: 0.5rem;
        line-height: 1.4;
    }
    table td:nth-child(5) { /* Published */
        font-size: 0.9em;
        color: #666;
        margin-top: 0.5rem;
    }
    table thead {
        display: none;
    }

    /* Settings patterns buttons stacked vertically */
    #user-patterns .modify {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
    }

    .patterns-container {
        grid-template-columns: 1fr;
    }

    .severity-block table {
        margin-bottom: 1rem;
    }

    .severity-block thead {
        display: none;
    }

    .severity-block td {
        display: block;
        width: 100%;
        text-align: left;
        border: none;
        padding: 0.25rem 0;
    }

    .severity-block .pattern {
        font-weight: bold;
    }

    .severity-block .modify {
        text-align: right;
        margin-top: 0.5rem;
        margin-right: 1rem;
    }

    .severity-block .add-input {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .severity-block .add-input input {
        max-width: 70%;
    }
    .severity-block .add-input button {
        text-align: right;
    }
    #user-patterns .modify input, #user-patterns .modify button {
        /* Margins handled by flex gap */
    }

    /* Admin list responsive */
    #admin ul {
        list-style: none;
        padding: 0;
    }
    #admin li {
        margin-bottom: 0.5rem;
    }
    #admin a {
        display: block;
        padding: 1rem;
        text-align: center;
        background: #f8f9fa;
        border-radius: 4px;
        text-decoration: none;
        color: inherit;
    }
    #admin a:hover {
        background: #e9ecef;
    }

    /* Make result buttons narrower on mobile */
    .result-button {
        max-width: 150px;
        width: auto;
    }

    /* Inventory search on mobile */
    .inventory-search {
        flex-direction: column;
    }
    .inventory-search input {
        max-width: none;
    }

    /* Mobile inventory items */
    .inventory-item {
        border-bottom: 1px solid #eee;
        padding: 1rem 0;
    }
    .inventory-item .brand,
    .inventory-item .name,
    .inventory-item .category,
    .inventory-item .sku {
        margin-bottom: 0.5rem;
    }
    .inventory-item .actions {
        margin-top: 0.5rem;
    }
}

/* Admin form spacing */
#edit-recall-form div + div {
    margin-top: 1.5rem;
}

#edit-recall-form label {
    display: block;
    margin-bottom: 0.5rem;
}

#edit-recall-form textarea {
    width: 100%;
    min-height: 150px;
}



/* Prevent scrolling on view original recall paragraph */
.view-original {
    overflow: hidden;
    white-space: nowrap;
    margin: 0;
}

/* General button enhancements */
button {
    transition: background-color 0.3s ease, transform 0.2s ease;
}

button:hover {
    transform: translateY(-2px);
}

/* Add subtle animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

main > * {
    animation: fadeIn 0.5s ease-out;
}

/* Bold text in modal description */
.alert-dialog strong {
    color: var(--primary-color);
    font-weight: 700;
}

/* Scan page sections */
#product-recalls {
    margin-top: 1rem;
}

#recent-scans {
    margin-top: 1rem;
}

#integrations article.card {
    margin-bottom: 1rem;
}
