/**
 * Packing List Planner - Frontend CSS
 * Modern design with rich color scheme and responsive layout
 */

/* ─── CSS Variables ─── */
:root {
    --plp-primary: #2563eb;
    --plp-primary-dark: #1d4ed8;
    --plp-primary-light: #dbeafe;
    --plp-violet: #7c3aed;
    --plp-violet-light: #ede9fe;
    --plp-pink: #db2777;
    --plp-pink-light: #fce7f3;
    --plp-red: #dc2626;
    --plp-red-light: #fee2e2;
    --plp-emerald: #059669;
    --plp-emerald-light: #d1fae5;
    --plp-amber: #d97706;
    --plp-amber-light: #fef3c7;
    --plp-cyan: #0891b2;
    --plp-cyan-light: #cffafe;
    --plp-orange: #ea580c;
    --plp-orange-light: #ffedd5;
    --plp-dark: #0f172a;
    --plp-gray-50: #f8fafc;
    --plp-gray-100: #f1f5f9;
    --plp-gray-200: #e2e8f0;
    --plp-gray-300: #cbd5e1;
    --plp-gray-400: #94a3b8;
    --plp-gray-500: #64748b;
    --plp-gray-600: #475569;
    --plp-gray-700: #334155;
    --plp-gray-800: #1e293b;
    --plp-gray-900: #0f172a;
    --plp-radius-sm: 6px;
    --plp-radius-md: 10px;
    --plp-radius-lg: 14px;
    --plp-radius-xl: 18px;
    --plp-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --plp-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --plp-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* ─── Wrapper - Break out of WordPress parent containers ─── */
.plp-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--plp-gray-700);
    line-height: 1.7;
    position: relative;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    overflow-x: hidden;
    padding-bottom: 40px;
}

/* ─── Container ─── */
.plp-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ─── Full-width Header ─── */
.plp-header {
    position: relative;
    width: 100%;
    text-align: center;
    padding: 40px 20px 48px;
    background:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(37, 99, 235, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 80% 60%, rgba(124, 58, 237, 0.12), transparent),
        linear-gradient(135deg, #0f172a 0%, #1e3a5f 40%, #1e293b 100%);
    color: #fff;
    overflow: hidden;
}

.plp-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 10% 20%, rgba(37, 99, 235, 0.25) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(219, 39, 119, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(124, 58, 237, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.plp-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to top, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

.plp-header-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.plp-header-title {
    font-size: 32px;
    font-weight: 800;
    margin: 0 0 10px;
    color: #fff !important;
    line-height: 1.2;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.plp-header-subtitle {
    font-size: 15px;
    color: rgba(255,255,255,0.75);
    margin: 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ─── Filters ─── */
.plp-filters {
    margin: 16px 0 12px;
    padding: 12px 0;
    background: var(--plp-gray-50);
    border-top: 1px solid var(--plp-gray-200);
    border-bottom: 1px solid var(--plp-gray-200);
}

.plp-filter-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.plp-filter-group {
    flex: 1;
    min-width: 0;
}

.plp-filter-group label {
    display: none;
}

.plp-filter-select {
    width: 100%;
    padding: 9px 32px 9px 12px;
    border: 2px solid var(--plp-gray-200);
    background: #fff;
    color: var(--plp-gray-700);
    border-radius: var(--plp-radius-md);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

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

/* ─── Sticky Action Buttons ─── */
.plp-sticky-actions {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 100;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    padding: 10px;
    border-radius: var(--plp-radius-lg);
    border: 1px solid var(--plp-gray-200);
    box-shadow: var(--plp-shadow-lg);
}

.plp-btn-reset,
.plp-btn-download {
    padding: 10px 20px;
    border-radius: var(--plp-radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    white-space: nowrap;
}

.plp-btn-reset {
    background: #fff;
    color: var(--plp-gray-600);
    border-color: var(--plp-gray-200);
}

.plp-btn-reset:hover {
    border-color: var(--plp-red);
    color: var(--plp-red);
}

.plp-btn-download {
    background: linear-gradient(135deg, var(--plp-primary) 0%, var(--plp-primary-dark) 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.plp-btn-download:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

/* ─── Categories ─── */
.plp-categories {
    margin-bottom: 40px;
}

.plp-category {
    margin-bottom: 16px;
}

.plp-category-details {
    border: 1px solid var(--plp-gray-200);
    border-radius: var(--plp-radius-lg);
    background: #fff;
    overflow: hidden;
    box-shadow: var(--plp-shadow-sm);
    transition: box-shadow 0.3s;
}

.plp-category-details:hover {
    box-shadow: var(--plp-shadow-md);
}

.plp-category-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    list-style: none;
    font-weight: 700;
    font-size: 15px;
    color: var(--plp-gray-800);
    background: linear-gradient(135deg, var(--cat-color, var(--plp-primary)) 0%, color-mix(in srgb, var(--cat-color, var(--plp-primary)) 80%, #000) 100%);
    color: #fff;
    user-select: none;
    position: relative;
}

.plp-category-header::-webkit-details-marker {
    display: none;
}

.plp-category-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}

.plp-category-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plp-category-count {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    background: rgba(255,255,255,0.2);
    border-radius: 50px;
    flex-shrink: 0;
}

.plp-category-toggle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s;
    flex-shrink: 0;
}

.plp-category-toggle::after {
    content: '▼';
    font-size: 10px;
    opacity: 0.8;
}

.plp-category-details[open] .plp-category-toggle {
    transform: rotate(180deg);
}

/* Batch select button in category header */
.plp-select-all {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.plp-select-all:hover {
    background: rgba(255,255,255,0.35);
    border-color: rgba(255,255,255,0.5);
}

/* ─── Items ─── */
.plp-items {
    padding: 12px;
}

.plp-item {
    padding: 14px 16px;
    border-radius: var(--plp-radius-md);
    margin-bottom: 8px;
    background: var(--plp-gray-50);
    border: 1px solid transparent;
    transition: all 0.25s;
    position: relative;
}

.plp-item:last-child {
    margin-bottom: 0;
}

.plp-item:hover {
    background: #fff;
    border-color: var(--plp-gray-200);
    box-shadow: var(--plp-shadow-sm);
}

.plp-item.hidden {
    display: none;
}

.plp-item.checked {
    background: var(--plp-primary-light);
    border-color: var(--plp-primary);
}

.plp-item.checked .plp-item-title {
    color: var(--plp-primary-dark);
}

.plp-item-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
}

.plp-item-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.plp-item-checkmark {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 2px solid var(--plp-gray-300);
    border-radius: var(--plp-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    background: #fff;
    flex-shrink: 0;
}

.plp-item-checkbox:checked + .plp-item-checkmark {
    background: var(--plp-emerald);
    border-color: var(--plp-emerald);
}

.plp-item-checkbox:checked + .plp-item-checkmark::after {
    content: '✓';
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.plp-item-icon {
    font-size: 18px;
    line-height: 1;
    min-width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.plp-item-title {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
    color: var(--plp-gray-800);
    transition: color 0.2s;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plp-item-priority {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 3px 10px;
    border-radius: 50px;
    white-space: nowrap;
    flex-shrink: 0;
}

.plp-priority-must {
    background: var(--plp-red-light);
    color: var(--plp-red);
}

.plp-priority-recommended {
    background: var(--plp-amber-light);
    color: var(--plp-amber);
}

.plp-priority-optional {
    background: var(--plp-emerald-light);
    color: var(--plp-emerald);
}

.plp-priority-caution {
    background: var(--plp-red-light);
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.plp-item-content {
    margin-top: 8px;
    margin-left: 56px;
    padding-top: 8px;
    border-top: 1px dashed var(--plp-gray-200);
    display: none;
}

.plp-item-content.show {
    display: block;
    animation: plpFadeIn 0.3s ease;
}

@keyframes plpFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.plp-item-description {
    font-size: 13px;
    color: var(--plp-gray-600);
    margin: 0 0 8px;
    line-height: 1.6;
}

.plp-item-tip {
    font-size: 12px;
    color: var(--plp-gray-500);
    margin: 0 0 8px;
    padding: 8px 12px;
    background: var(--plp-primary-light);
    border-radius: var(--plp-radius-sm);
    border-left: 3px solid var(--plp-primary);
}

.plp-item-tip strong {
    color: var(--plp-primary-dark);
}

.plp-item-link {
    margin: 0;
}

.plp-item-link a {
    font-size: 12px;
    color: var(--plp-primary);
    text-decoration: none;
    font-weight: 600;
}

.plp-item-link a:hover {
    text-decoration: underline;
}

/* ─── FAQ ─── */
.plp-faq {
    margin: 40px auto;
    max-width: 900px;
}

.plp-faq-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--plp-gray-800);
    margin: 0 0 20px;
    text-align: center;
}

.plp-faq-list {
    border: 1px solid var(--plp-gray-200);
    border-radius: var(--plp-radius-lg);
    overflow: hidden;
    background: #fff;
    box-shadow: var(--plp-shadow-sm);
}

.plp-faq-item {
    border-bottom: 1px solid var(--plp-gray-100);
}

.plp-faq-item:last-child {
    border-bottom: none;
}

.plp-faq-question {
    padding: 16px 20px;
    font-weight: 600;
    font-size: 14px;
    color: var(--plp-gray-800);
    cursor: pointer;
    list-style: none;
    position: relative;
    padding-right: 40px;
}

.plp-faq-question::-webkit-details-marker {
    display: none;
}

.plp-faq-question::after {
    content: '+';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--plp-gray-400);
    transition: transform 0.3s;
}

.plp-faq-item[open] .plp-faq-question::after {
    content: '−';
    transform: translateY(-50%) rotate(0);
}

.plp-faq-answer {
    padding: 0 20px 16px;
    font-size: 13px;
    color: var(--plp-gray-600);
    line-height: 1.7;
}

/* ─── Footer ─── */
.plp-footer {
    text-align: center;
    padding: 24px;
    border-top: 1px solid var(--plp-gray-200);
    margin-top: 32px;
}

.plp-footer p {
    font-size: 12px;
    color: var(--plp-gray-500);
    margin: 0;
}

.plp-footer-disclaimer {
    margin-top: 6px !important;
    font-style: italic;
}

/* ─── Responsive ─── */
@media (max-width: 800px) {
    .plp-wrapper {
        width: 100vw;
        margin-left: calc(50% - 50vw);
        max-width: none;
    }
    .plp-container {
        max-width: 100%;
        padding: 0 16px;
        box-sizing: border-box;
    }
    .plp-category-details {
        border-radius: 0;
        margin-left: -1px;
        margin-right: -1px;
    }
}

@media (max-width: 768px) {
    .plp-wrapper {
        width: 100vw;
        margin-left: calc(50% - 50vw);
    }
    .plp-container {
        max-width: 100%;
        padding: 0 12px;
    }
    .plp-header {
        padding: 28px 16px 36px;
    }
    .plp-header-title {
        font-size: 22px;
    }
    .plp-header-subtitle {
        font-size: 13px;
    }
    .plp-filters {
        padding: 10px 0;
        margin: 12px 0 8px;
    }
    .plp-filter-row {
        gap: 8px;
    }
    .plp-filter-select {
        font-size: 12px;
        padding: 8px 28px 8px 10px;
    }
    .plp-sticky-actions {
        bottom: 10px;
        right: 10px;
        left: 10px;
        justify-content: center;
        gap: 8px;
        padding: 8px;
    }
    .plp-btn-reset,
    .plp-btn-download {
        padding: 8px 14px;
        font-size: 12px;
        flex: 1;
        text-align: center;
    }
    .plp-item {
        padding: 12px;
    }
    .plp-item-label {
        gap: 8px;
    }
    .plp-item-title {
        font-size: 13px;
        white-space: normal;
        word-break: break-word;
    }
    .plp-item-priority {
        font-size: 9px;
        padding: 2px 6px;
    }
    .plp-item-content {
        margin-left: 40px;
    }
    .plp-category-header {
        padding: 12px 14px;
        font-size: 14px;
        gap: 8px;
    }
    .plp-category-count {
        display: none;
    }
    .plp-select-all {
        font-size: 10px;
        padding: 3px 8px;
    }
    .plp-faq-title {
        font-size: 20px;
    }
}

/* ─── Print Styles ─── */
@media print {
    .plp-filters,
    .plp-category-toggle,
    .plp-item-checkbox,
    .plp-item-checkmark,
    .plp-btn-reset,
    .plp-btn-download,
    .plp-sticky-actions,
    .plp-select-all {
        display: none !important;
    }
    .plp-header {
        background: #fff !important;
        color: #000 !important;
        width: 100% !important;
        margin: 0 !important;
        left: 0 !important;
        right: 0 !important;
        padding: 20px !important;
        box-shadow: none !important;
    }
    .plp-header-title {
        color: #000 !important;
        text-shadow: none !important;
    }
    .plp-header-subtitle {
        color: #333 !important;
    }
    .plp-category-details {
        border: 1px solid #ccc;
        break-inside: avoid;
    }
    .plp-category-header {
        background: #f0f0f0 !important;
        color: #000 !important;
    }
    .plp-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    .plp-item.checked {
        background: #f0f7ff !important;
        border-color: #2563eb !important;
    }
    .plp-item.checked .plp-item-title {
        color: #1d4ed8 !important;
    }
    .plp-item-content {
        display: block !important;
    }
    .plp-faq {
        break-inside: avoid;
    }
}
