/* Global scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Modern, lightweight scrollbars */
:root {
    --scrollbar-track: #e8eef5;
    --scrollbar-thumb: #a8c5dc;
    --scrollbar-thumb-hover: #7ba8c9;
    --scrollbar-border: #d5e4f1;
}

* {
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
    scrollbar-width: thin;
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 8px;
}

*::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border: 2px solid var(--scrollbar-border);
    border-radius: 8px;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

body {
    font-family: Arial, sans-serif;
    background-color: #f6ecdf;
    margin: 0;
    padding: 0;
}

/* Screen reader only class for accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Search Form Card */
.search-form-card {
    background-color: #5dade2;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-form-header {
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background-color: #3c90c4;
    padding: 15px 25px;
    margin: 0;
    border-radius: 8px 8px 0 0;
}

.search-form-body {
    padding: 25px;
    background-color: #5dade2;
    border-radius: 0 0 8px 8px;
}

.form-container {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 15px;
}

.container {
    width: 100%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    box-sizing: border-box;
    overflow-x: hidden;
    margin: 0 auto;
}

.box {
    flex: 1;
    background-color: #5dade2;
    overflow-y: auto;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    padding: 20px;
}

.box-task {
    flex: 1;
    height: 3.5rem;
    background-color: #f6ecdf;
    width: 100%;
}

.box-title {
    text-align: left;
    margin: 0;
    color: white;
    width: auto;
    font-size: 16px;
    font-weight: 600;
}

.form-entry {
    margin-bottom: 1rem;
}

.form-fields {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 0;
}

.form-fields .rest-field {
    margin-left: 0;
    flex: 1;
}

.form-fields-dynamic {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    border: 0.1rem solid #cbd5e0;
    padding: 15px 15px;
    border-radius: 8px;
    margin-left: 10px;
    margin-right: 10px;
}

.rest-field {
    width: 30%;
    margin-top: 10px;
}

.field {
    flex: 1;
}

.label {
    display: block;
    font-size: 0.9rem;
    color: white;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
    color: #333;
    background-color: white;
    box-sizing: border-box;
}

.input:focus {
    outline: none;
    border-color: #5dade2;
    box-shadow: 0 0 0 2px rgba(93, 173, 226, 0.2);
}

.remove-btn {
    display: flex;
    justify-content: flex-start;
    background-color: white;
    color: #cbd5e0;
    width: 18px;
    height: 18px;
    font-size: 12px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    margin-left: 10px;
    margin-bottom: 3px;
    border: 1px solid #cbd5e0;
}

.remove-btn:hover {
    background-color: #d91f3d;
}

.add-btn-container {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
    margin-right: 10px;
    margin-bottom: 10px;
    background-color: white;
}

.add-btn {
    background-color: white;
    font-weight: bold;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.submit-btn-container {
    width: 30%;
    text-align: center;
    margin-top: 1.5rem;
}

.submit-btn {
    background-color: #ff9933;
    color: white;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 4px;
    transition: background-color 0.2s;
    width: 100%;
    border: none;
    outline: none;
    cursor: pointer;
    font-size: 15px;
    height: 42px;
}

.submit-btn:hover:not(:disabled) {
    background-color: #e68a2e;
}

.submit-btn:active:not(:disabled) {
    background-color: #cc7a29;
}

.submit-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
}

.phrases-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    max-width: 100%;
}

.phrase {
    background-color: #ff9933;
    color: white;
    padding: 7px 12px;
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.3s;
    font-size: 13px;
    font-weight: 500;
    border: none;
}

.phrase:hover {
    background-color: #e68a2e;
}

.phrase:active {
    background-color: #cc7a29;
}

.result {
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
    width: 80%;
    margin-top: 10px;
}

.loading {
    font-size: 18px;
    font-weight: bold;
    color: #555;
}

.suggestions-table {
    width: 80%;
    border-collapse: collapse;
    margin-top: 20px;
    margin-bottom: 20px;
    margin-left: 10px;
    margin-right: 10px;
}

.suggestions-table th,
.suggestions-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
}

.suggestions-table th {
    background-color: #193b7a;
    font-weight: bold;
    color: white;
}

.suggestion-box {
    margin-top: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    width: 98%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.highlighted {
    background-color: rgb(129 189 239 / 60%);
}

.result-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 40px 0px 40px;
}

.back-button {
    justify-self: start;
    background-color: #f6ecdf;
}

h1 {
    justify-self: center;
    margin: 0;
    font-size: 1.5rem;
}

.back-icon {
    height: 100px;
    width: auto;
}

.history_bar_button {
    background-color: transparent;
    border: none;
    cursor: pointer;
}

.history_bar_img {
    height: 30px;
    background-color: transparent;
}

.help-button {
    background-color: transparent;
    color: white;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 5px;
    padding: 0;
    height: auto;
}

.pricing-rules-section {
    margin-top: 20px;
    margin-bottom: 20px;
}

.pricing-rules-header-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.pricing-rules-label {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
    color: white;
}

.rules-input {
    width: 60%;
    padding: 0.75rem;
    border: 1px solid #cbd5e0;
    border-radius: 0.375rem;
    font-size: 1rem;
    color: #2d3748;
    background-color: white;
}

/* ============================================
   SIDEBAR COMPONENTS - Production Ready
   ============================================ */

/* Backdrop with blur effect */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 38, 79, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
}

/* Sidebar Menu */
.sidebar-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 480px;
    max-width: 90vw;
    height: 100vh;
    background-color: #0f264f;
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    overflow: hidden;
}

/* Tailwind-like utility classes for Alpine transitions */
.translate-x-full {
    transform: translateX(100%);
}

.translate-x-0 {
    transform: translateX(0);
}

.opacity-0 {
    opacity: 0;
}

.opacity-100 {
    opacity: 1;
}

.rotate-0 {
    transform: rotate(0deg);
}

.rotate-180 {
    transform: rotate(180deg);
}

.transition-transform {
    transition-property: transform;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.duration-300 {
    transition-duration: 300ms;
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.sidebar-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.sidebar-close-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.sidebar-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

/* Filters Section */
.sidebar-filters {
    padding: 20px;
    border-radius: 8px;
    margin: 0 20px 16px;
    flex-shrink: 0;
}

.filters-toggle-btn {
    width: 100%;
    padding: 14px 18px;
    background: linear-gradient(135deg, #ffad49 0%, #ff9933 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 173, 73, 0.3);
}

.filters-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 173, 73, 0.4);
}

.filters-toggle-btn.active {
    border-radius: 8px 8px 0 0;
}

.filters-panel {
    background-color: #3c90c4;
    padding: 20px;
    border-radius: 0 0 8px 8px;
}

/* Filter Groups */
.filter-group {
    margin-bottom: 16px;
}

.filter-group-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.filter-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: white;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-input-wrapper {
    position: relative;
}

.filter-input,
.filter-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-size: 14px;
    background-color: white;
    color: #2d3748;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: #ffad49;
    box-shadow: 0 0 0 3px rgba(255, 173, 73, 0.2);
}

.filter-select {
    cursor: pointer;
}

/* Villa Dropdown */
.villa-dropdown {
    position: absolute;
    width: 100%;
    margin-top: 4px;
    max-height: 240px;
    overflow-y: auto;
    background-color: white;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.villa-dropdown-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f1f1f1;
    color: #2d3748;
    font-size: 14px;
    transition: background-color 0.15s ease;
}

.villa-dropdown-item:hover {
    background-color: #f7fafc;
}

.villa-dropdown-item:last-child {
    border-bottom: none;
}

/* Filter Actions */
.filter-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-primary,
.btn-secondary {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #ffad49 0%, #ff9933 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(255, 173, 73, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(255, 173, 73, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: white;
    color: #3c90c4;
    border: 2px solid white;
}

.btn-secondary:hover {
    background-color: #f2f7fb;
    color: #3c90c4;
}

.btn-secondary:active {
    background-color: #e6f0f9;
    color: #3c90c4;
}

/* Results Count */
.results-count {
    padding: 12px 20px;
    margin: 0 20px 16px;
    background: linear-gradient(135deg, #3c90c4 0%, #2b7cb0 100%);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

/* Loading State */
.sidebar-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    gap: 16px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffad49;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Empty State */
.sidebar-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
    gap: 12px;
}

.sidebar-empty svg {
    opacity: 0.5;
}

/* Results List */
.sidebar-results {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 20px;
}

/* Custom Scrollbar */
.sidebar-results::-webkit-scrollbar {
    width: 6px;
}

.sidebar-results::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-results::-webkit-scrollbar-thumb {
    background: rgba(255, 173, 73, 0.5);
    border-radius: 3px;
}

.sidebar-results::-webkit-scrollbar-thumb:hover {
    background: #ffad49;
}

/* Result Card */
.result-card {
    background-color: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.result-card.clickable {
    cursor: pointer;
}

.result-card.clickable:hover {
    transform: translateX(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border-color: #ffad49;
}

.result-card.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.result-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.result-card-date {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #0f264f;
}

.result-card-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-card-body {
    margin-bottom: 12px;
}

.result-card-info {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    color: #4a5568;
}

.result-card-info strong {
    color: #2d3748;
    font-weight: 600;
}

.result-card-email {
    font-size: 11px;
    color: #718096;
}

.result-card-footer {
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
    font-size: 12px;
    color: #a0aec0;
    font-style: italic;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 640px) {
    .sidebar-menu {
        width: 100vw;
        max-width: 100vw;
    }

    .filter-group-row {
        grid-template-columns: 1fr;
    }
}

/* Legacy sidebar compatibility */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 450px;
    height: 100vh;
    background-color: #0f264f;
    color: white;
    padding: 20px;
    padding-top: 50px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    border-left: 0.1rem solid #cbd5e0;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
}

.sidebar.show {
    transform: translateX(0);
}

.sidebar ul {
    list-style: none;
    padding: 0;
}

.sidebar li {
    margin: 10px 0;
}

.toggle-button {
    margin: 20px;
    padding: 10px 15px;
    background-color: #3498db;
    color: white;
    border: none;
    cursor: pointer;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
    width: 300px;
    text-align: center;
    position: relative;
}

.card-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px;
}

.card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 15px;
    box-sizing: border-box;
    transition: none;
    text-decoration: none;
    color: inherit;
}

.card-container .card {
    width: 300px;
}

.card:hover {
    transform: none;
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 10px;
    font-weight: bold;
}

.card-text {
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.card-text strong {
    font-weight: bold;
}

.card a {
    text-decoration: none;
    color: inherit;
}

.card a:visited {
    color: inherit;
}

.card a:link {
    color: inherit;
}

.tooltip-container {
    position: relative;
    display: inline-block;
}

.tooltip-container .tooltip-text {
    visibility: hidden;
    background-color: #f3f3f3;
    color: #333;
    padding: 8px 12px;
    border-radius: 8px;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    max-width: 350px;
    white-space: normal;
    text-align: left;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 10;
    width: 220px;
    font-size: 0.8125rem;
    line-height: 1.5;
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.uniform-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.uniform-row .rest-field {
    margin-left: 0;
}

.uniform-input {
    width: 100%;
    height: 42px;
    box-sizing: border-box;
    border-radius: 4px;
    font-size: 0.95rem;
}

.submit-field {
    width: 150px;
    flex-shrink: 0;
}

.rules-textarea {
    width: 100%;
    height: 80px;
    resize: none;
    margin-bottom: 15px;
    border-radius: 4px;
}

.container-results {
    width: 95%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 20px auto;
    box-sizing: border-box;
    overflow-x: hidden;
    background-color: white;
    color: #555;
    text-align: left;
    border-radius: 0.5rem;
}

/* Hide Alpine x-show before init */
[x-cloak] {
    display: none !important;
}

/* ============================================
   PAGE HEADER COMPONENT
   ============================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-header__left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-header__hamburger-btn {
    background-color: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.page-header__hamburger-btn:hover {
    background-color: rgba(93, 173, 226, 0.1);
}

.page-header__hamburger-btn .page-header__icon {
    font-size: 24px;
    color: #5dade2;
}

.page-header__title-section {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.page-header__title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: #5dade2;
    line-height: 1.2;
}

.page-header__subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: #5dade2;
    font-weight: 500;
}

.page-header__right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-header__icon-btn {
    background-color: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.page-header__icon-btn:hover {
    background-color: rgba(93, 173, 226, 0.1);
}

.page-header__icon {
    font-size: 20px;
    color: #5dade2;
}

@media (max-width: 768px) {
    .page-header {
        padding: 12px 16px;
    }

    .page-header__title {
        font-size: 1.25rem;
    }

    .page-header__subtitle {
        font-size: 0.75rem;
    }

    .page-header__hamburger-btn .page-header__icon {
        font-size: 20px;
    }

    .page-header__icon-btn .page-header__icon {
        font-size: 18px;
    }
}
