/* Resources page - search + card list */

:root {
    --res-primary: #ff8ba7;
    --res-primary-dark: #e5708e;
    --res-bg: #f5f5f7;
    --res-card-bg: #ffffff;
    --res-text: #2d3436;
    --res-text-sec: #636e72;
    --res-border: #ececf0;
    --res-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --res-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --res-shadow-hover: 0 12px 24px rgba(255, 139, 167, 0.18);
    --res-baidu: #06a7ff;
    --res-quark: #f59e0b;
    --res-green: #27ae60;
    --res-red: #e74c3c;
}

/* Resources page uses the shared full-screen .page-section shell.
   No sidebar here, so center the content in a single scrollable column. */
#resources-section {
    overflow-y: auto;
    background: var(--res-bg);
}

.resources-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 22px 20px 60px;
    width: 100%;
}

/* ---------- Header / Search ---------- */
.resources-header {
    margin-bottom: 22px;
}

.resources-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--res-text);
    margin-bottom: 16px;
}

.resources-title i {
    color: var(--res-primary);
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.search-input-wrap {
    position: relative;
    flex: 1;
}

.search-input-wrap i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #b2b2b2;
    font-size: 1rem;
}

.search-input {
    width: 100%;
    padding: 13px 16px 13px 44px;
    border: 2px solid var(--res-border);
    border-radius: 30px;
    font-size: 1rem;
    background: var(--res-card-bg);
    color: var(--res-text);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.search-input:focus {
    outline: none;
    border-color: var(--res-primary);
    box-shadow: 0 0 0 4px rgba(255, 139, 167, 0.12);
}

.search-btn {
    padding: 0 24px;
    border: none;
    border-radius: 30px;
    background: linear-gradient(135deg, var(--res-primary) 0%, #ffb3c1 100%);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 139, 167, 0.35);
}

.search-btn:active {
    transform: translateY(0);
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-select {
    padding: 9px 34px 9px 14px;
    border: 2px solid var(--res-border);
    border-radius: 22px;
    background: var(--res-card-bg);
    color: var(--res-text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.filter-select:hover,
.filter-select:focus {
    border-color: var(--res-primary);
    outline: none;
}

/* View mode tabs (全部 / 我的保存) */
.view-tabs {
    display: flex;
    gap: 0;
    border: 2px solid var(--res-border);
    border-radius: 22px;
    overflow: hidden;
    background: var(--res-card-bg);
}

.view-tab {
    padding: 9px 16px;
    border: none;
    background: transparent;
    color: var(--res-text-sec);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.view-tab:hover {
    color: var(--res-text);
    background: #f5f5f7;
}

.view-tab.active {
    background: linear-gradient(135deg, var(--res-primary) 0%, #ffb3c1 100%);
    color: #fff;
}

.view-tab i {
    font-size: 0.8rem;
}

/* ---------- Results meta ---------- */
.results-meta {
    align-items: center;
    justify-content: space-between;
    margin: 4px 2px 14px;
    font-size: 0.85rem;
    color: var(--res-text-sec);
}

.results-meta .query-tag {
    color: var(--res-primary-dark);
    font-weight: 600;
}

/* ---------- Card grid ---------- */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.resource-card {
    background: var(--res-card-bg);
    border: 1px solid var(--res-border);
    border-radius: 14px;
    box-shadow: var(--res-shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.18s, box-shadow 0.2s, border-color 0.2s;
}

.resource-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--res-shadow-hover);
    border-color: rgba(255, 139, 167, 0.4);
}

.resource-card.invalid {
    opacity: 0.78;
}

.card-body {
    padding: 16px 16px 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge.type {
    background: #f0f3f7;
    color: #5b6b7a;
}

.badge.source-baidu {
    background: rgba(6, 167, 255, 0.12);
    color: var(--res-baidu);
}

.badge.source-quark {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.badge.invalid {
    background: rgba(231, 76, 60, 0.12);
    color: var(--res-red);
}

.badge.valid {
    background: rgba(39, 174, 96, 0.12);
    color: var(--res-green);
}

.resource-name {
    font-size: 1.05rem;
    font-weight: 650;
    color: var(--res-text);
    text-decoration: none;
    line-height: 1.35;
    margin-bottom: 4px;
    word-break: break-word;
    transition: color 0.2s;
}

.resource-name:hover {
    color: var(--res-primary-dark);
}

.resource-name-en {
    font-size: 0.82rem;
    color: var(--res-text-sec);
    margin-bottom: 8px;
    word-break: break-word;
}

.resource-desc {
    font-size: 0.86rem;
    line-height: 1.5;
    color: var(--res-text-sec);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    border-top: 1px solid var(--res-border);
    padding: 12px 16px 14px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

.meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--res-text-sec);
}

.meta-row i {
    width: 16px;
    text-align: center;
    color: #b2b2b2;
    flex-shrink: 0;
}

.meta-label {
    color: #9aa0a6;
}

.meta-value {
    color: var(--res-text);
    font-weight: 500;
    word-break: break-all;
}

.meta-value.expired {
    color: var(--res-red);
}

.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.card-action {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    border: 1px solid var(--res-border);
    background: #fafafa;
    color: var(--res-text-sec);
}

.card-action:hover {
    border-color: var(--res-primary);
    color: var(--res-primary-dark);
    background: #fff;
}

.card-action.primary {
    background: linear-gradient(135deg, var(--res-primary) 0%, #ffb3c1 100%);
    color: #fff;
    border-color: transparent;
}

.card-action.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 139, 167, 0.35);
    color: #fff;
}

.card-action.saved {
    background: #fff7e6;
    border-color: #ffc069;
    color: #d48806;
}

.card-action.saved:hover {
    background: #fff1cc;
    border-color: #ffa940;
}

/* ---------- States ---------- */
.state-box {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #aaa;
}

.state-box i {
    font-size: 2.6rem;
    margin-bottom: 14px;
    color: #d3d3d8;
    display: block;
}

.state-box .state-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--res-text-sec);
    margin-bottom: 6px;
}

.state-box .state-sub {
    font-size: 0.88rem;
    color: #b3b3b8;
}

.loading-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.skeleton-card {
    background: var(--res-card-bg);
    border: 1px solid var(--res-border);
    border-radius: 14px;
    padding: 16px;
    height: 200px;
    position: relative;
    overflow: hidden;
}

.skeleton-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 139, 167, 0.08), transparent);
    animation: skeleton-shimmer 1.3s infinite;
}

@keyframes skeleton-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* No mobile sidebar on this page -> hide the (otherwise dangling) hamburger */
body[data-page="resources"] .menu-toggle {
    display: none !important;
}

@media (max-width: 600px) {
    .resources-container {
        padding: 16px 14px 80px;
    }

    .resources-title {
        font-size: 1.3rem;
    }

    .search-btn span {
        display: none;
    }

    .search-btn {
        padding: 0 18px;
    }

    .resources-grid,
    .loading-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- Premium Share Modal Styles ---------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    background: var(--res-card-bg);
    width: 90%;
    max-width: 580px;
    max-height: 90vh;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal-container {
    transform: translateY(0);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--res-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--res-text);
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 1.5rem;
    color: var(--res-text-sec);
    cursor: pointer;
    transition: color 0.2s;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--res-red);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

/* Parse section */
.parse-section {
    background: #fafafa;
    border: 1px dashed var(--res-border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 20px;
}

.parse-hint {
    font-size: 0.82rem;
    color: var(--res-text-sec);
    margin-bottom: 8px;
    font-weight: 500;
}

.parse-section textarea {
    width: 100%;
    height: 60px;
    padding: 8px 12px;
    border: 1px solid var(--res-border);
    border-radius: 8px;
    font-size: 0.85rem;
    resize: none;
    box-sizing: border-box;
    outline: none;
    font-family: inherit;
}

.parse-section textarea:focus {
    border-color: var(--res-primary);
}

.parse-section .btn-success {
    margin-top: 8px;
    width: 100%;
    justify-content: center;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--res-text);
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--res-border);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--res-text);
    background: var(--res-card-bg);
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.form-group input[type="text"]:focus,
.form-group input[type="date"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--res-primary);
    box-shadow: 0 0 0 3px rgba(255, 139, 167, 0.12);
}

.form-group textarea {
    resize: vertical;
    min-height: 70px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Buttons style inside modal */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--res-primary) 0%, #ffb3c1 100%);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 139, 167, 0.35);
}

.btn-secondary {
    background: #f0f0f3;
    color: var(--res-text-sec);
}

.btn-secondary:hover {
    background: #e6e6eb;
    color: var(--res-text);
}

.btn-success {
    background: #27ae60;
    color: #fff;
}

.btn-success:hover {
    background: #219653;
}

/* Card modifications */
.badge.offline {
    background: rgba(120, 120, 120, 0.12);
    color: #777;
}

.resource-card.offline {
    border-color: #ddd;
    opacity: 0.7;
}

.edit-btn {
    border-color: #bae7ff;
    color: #096dd9;
    background: #e6f7ff;
}

.edit-btn:hover {
    border-color: #40a9ff;
    background: #bae7ff;
    color: #096dd9;
}

.delete-btn {
    border-color: #ffa39e;
    color: #cf1322;
    background: #fff1f0;
}

.delete-btn:hover {
    border-color: #ff4d4f;
    background: #ffa39e;
    color: #cf1322;
}
