/* =========================
   Dashboard Layout
========================= */
.dashboard-page {
    max-width: 1280px;
    margin: 0 auto;
}

.dashboard-header {
    margin-bottom: 24px;
}

.dashboard-header h1 {
    font-size: 30px;
    margin-bottom: 8px;
}

.dashboard-header-card {
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 24px 28px;
    margin-bottom: 24px;
}

.dashboard-header-card h1 {
    margin-bottom: 8px;
}

.dashboard-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.dashboard-sidebar {
    width: 280px;
    min-width: 280px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 20px;
}

.dashboard-main {
    flex: 1;
    min-width: 0;
}

.history-drawer-overlay {
    display: none;
}

/* =========================
   Mobile History Drawer
========================= */
@media (max-width: 1100px) {
    .dashboard-sidebar {
        position: fixed;
        top: 0;
        right: 0;
        width: 82%;
        max-width: 340px;
        height: 100dvh;
        z-index: 1001;
        border-radius: 0;
        padding: 90px 20px 20px;
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }

    .dashboard-sidebar.drawer-open {
        transform: translateX(0);
    }

    .history-drawer-overlay {
        position: fixed;
        inset: 0;
        display: block;
        background: rgba(0, 0, 0, 0.35);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .history-drawer-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

@media (min-width: 1101px) {
    #history-drawer-toggle-btn {
        display: none !important;
    }

    .dashboard-sidebar {
        position: static;
        transform: none !important;
        height: auto;
        border-radius: 24px;
        padding: 20px;
        z-index: auto;
    }

    .history-drawer-overlay {
        display: none !important;
    }
}

/* =========================
   Toolbar
========================= */
.dashboard-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.dashboard-toolbar-right,
.dashboard-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.dashboard-toolbar button {
    min-width: 110px;
}

.toolbar-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    min-height: 46px;
    padding: 0 16px;
}

.toolbar-logout-form {
    margin: 0;
}

.toolbar-logout-btn {
    min-height: 46px;
    padding: 0 16px;
}

/* =========================
   Search Sections
========================= */
.search-section {
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 24px;
    margin-bottom: 24px;
}

.search-section h2 {
    margin-bottom: 8px;
    font-size: 20px;
}

.search-section p {
    color: #6b7280;
    line-height: 1.9;
    margin-bottom: 16px;
}

.simple-search-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.simple-search-row input[type="text"] {
    flex: 1;
    min-width: 0;
}

.simple-search-row button {
    min-width: 130px;
}

/* =========================
   Advanced Search Form
========================= */
.advanced-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.advanced-form-grid .full-width {
    grid-column: 1 / -1;
}

.advanced-submit-row {
    margin-top: 18px;
}

/* =========================
   Sidebar History
========================= */
.history-title {
    font-size: 18px;
    color: #333;
    margin-bottom: 14px;
}

.history-empty {
    color: #777;
    font-size: 14px;
    text-align: center;
    margin-top: 10px;
}

.run-history-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.run-history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 8px;
    border-radius: 14px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.run-history-item:hover {
    transform: translateY(-1px);
}

.run-history-item.active {
    background: #e6edff;
    box-shadow: 0 0 0 3px rgba(108, 140, 255, 0.08);
}

.run-history-link {
    flex: 1;
    display: block;
    padding: 12px;
    border: none;
    border-radius: 14px;
    background: #f5f7ff;
    text-decoration: none;
    color: #333;
    line-height: 1.8;
    transition: 0.3s;
}

.run-history-link:hover {
    background: #e8edff;
}

.delete-run-btn {
    width: 42px;
    min-width: 42px;
    height: 42px;
    border: none;
    border-radius: 14px;
    background: #fff0f0;
    border: 1px solid #f3caca;
    color: #c62828;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.delete-run-btn:hover {
    background: #ffe3e3;
}

/* =========================
   Result Section
========================= */
.result-section {
    overflow: hidden;
}

.result-section h2 {
    margin-bottom: 14px;
    font-size: 22px;
    color: #2e3a59;
    padding-bottom: 10px;
    border-bottom: 1px solid #eef2ff;
}

.result-meta {
    margin-bottom: 18px;
    background: #f8fbff;
    border: 1px solid #e6ecff;
    border-radius: 16px;
    padding: 16px;
}

.result-meta p {
    margin-bottom: 8px;
    color: #374151;
    line-height: 1.8;
}

.card-shell {
    background: #ffffff;
    border-radius: 28px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.85);
    padding: 24px;
}

.result-items-container {
    margin-top: 20px;
}

.result-items-container {
    margin-top: 20px;
    background: #f8fbff;
    border: 1px solid #e6ecff;
    border-radius: 18px;
    padding: 16px;
    min-height: 80px;
}

.result-empty-box {
    background: #fff;
    border: 1px dashed #d8e2ff;
    border-radius: 16px;
    padding: 24px 18px;
    text-align: center;
    color: #64748b;
    line-height: 1.9;
}

.result-empty-box .empty-text {
    margin: 0;
}

.result-card {
    background: linear-gradient(180deg, #fbfcff 0%, #f8faff 100%);
    border: 1px solid #e3eaff;
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
}

.result-card:hover {
    box-shadow: 0 10px 26px rgba(108, 140, 255, 0.08);
    border-color: #cfdbff;
}

.result-card h3 {
    margin-bottom: 12px;
    font-size: 18px;
    color: #1f2937;
}

.result-field {
    margin-bottom: 10px;
    line-height: 1.9;
    color: #374151;
}

.result-field strong {
    color: #1f2937;
}

.result-link {
    color: #3556b3;
    text-decoration: none;
    word-break: break-word;
}

.result-link:hover {
    text-decoration: underline;
}

.result-badge {
    display: inline-block;
    padding: 4px 8px;
    background: #eee;
    border-radius: 6px;
}

.result-multiline {
    white-space: pre-line;
}

/* =========================
   Utility
========================= */
.section-hidden {
    display: none !important;
}

/* =========================
   Responsive
========================= */
@media (max-width: 1100px) {
    .dashboard-layout {
        flex-direction: column;
    }

    .dashboard-sidebar {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 768px) {
    .dashboard-header h1 {
        font-size: 24px;
    }

    .search-section,
    .result-section,
    .dashboard-sidebar {
        padding: 18px;
        border-radius: 20px;
    }

    .simple-search-row {
        flex-direction: column;
        align-items: stretch;
    }

    .advanced-form-grid {
        grid-template-columns: 1fr;
    }

    .run-history-item {
        align-items: stretch;
    }

    .delete-run-btn {
        width: 100%;
        min-width: 0;
        height: 44px;
    }

    .dashboard-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-toolbar-left,
    .dashboard-toolbar-right {
        width: 100%;
    }

    .dashboard-toolbar-left {
        order: 1;
    }

    .dashboard-toolbar-right {
        order: 2;
    }

    .dashboard-toolbar-left > *,
    .dashboard-toolbar-right > * {
        flex: 1 1 auto;
    }
}

/* =========================
   Dashboard Loading Overlay
========================= */
.dashboard-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.35);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashboard-loading-box {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.dashboard-loading-gif {
    width: 84px;
    height: 84px;
    display: block;
}