/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700&display=swap');

:root {
    --primary-color: #3730a3; /* indigo-800 */
    --primary-hover: #312e81; /* indigo-900 */
    --success-color: #16a34a;
    --success-hover: #15803d;
    --danger-color: #dc2626;
    --danger-hover: #b91c1c;
    --warning-color: #f59e0b;
    --warning-hover: #d97706;

    --text-dark: #1e293b; /* slate-800 */
    --text-light: #64748b; /* slate-500 */
    --text-white: #ffffff;
    
    --border-color: #e2e8f0; /* slate-200 */
    --border-hover-color: #cbd5e1; /* slate-300 */
    
    --app-bg: #f8fafc; /* slate-50 */
    --app-bg-gradient-start: #f0f4ff;
    --card-bg: #ffffff;
    --header-bg: rgba(255, 255, 255, 0.8);
    --table-header-bg: #f8fafc;
    --table-row-even-bg: #fdfdff;
    --combobox-hover-bg: #f8fafc;
    --input-bg: #ffffff;
    --accessory-bg: var(--app-bg);

    --secondary-btn-bg: #e2e8f0;
    --secondary-btn-hover-bg: #cbd5e1;
    --secondary-btn-text: var(--text-dark);
    
    --ring-color: rgba(55, 48, 163, 0.4);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

body.dark {
    --text-dark: #e5e7eb; /* gray-200 */
    --text-light: #9ca3af; /* gray-400 */
    
    --border-color: #374151; /* gray-700 */
    --border-hover-color: #4b5563; /* gray-600 */

    --app-bg: #111827; /* gray-900 */
    --app-bg-gradient-start: #111827; /* No gradient in dark mode */
    --card-bg: #1f2937; /* gray-800 */
    --header-bg: rgba(31, 41, 55, 0.8);
    --table-header-bg: #374151; /* gray-700 */
    --table-row-even-bg: #1a2330; /* a bit lighter than card bg */
    --combobox-hover-bg: #374151; /* gray-700 */
    --input-bg: #1f2937; /* gray-800 */
    --accessory-bg: #111827;
    
    --secondary-btn-bg: #374151;
    --secondary-btn-hover-bg: #4b5563;
    --secondary-btn-text: var(--text-dark);

    --ring-color: rgba(79, 70, 229, 0.5); /* indigo-500 */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.2);
}


body {
    font-family: 'Be Vietnam Pro', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--app-bg);
    background-image: linear-gradient(180deg, var(--app-bg-gradient-start) 0%, var(--app-bg) 25%);
    color: var(--text-dark);
    margin: 0;
    transition: background-color 0.3s, color 0.3s;
}

/* --- Layout & Container --- */
.container {
    width: 100%;
    padding: 0; /* Let children handle padding */
    box-sizing: border-box;
}
.main-container { padding: 1.5rem 0; }
.grid-layout { display: grid; grid-template-columns: 1fr; gap: 2rem; }
@media (min-width: 1024px) {
    .grid-layout { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
    .sidebar-card { position: sticky; top: 7rem; align-self: start; }
}
.grid-2-col { display: grid; grid-template-columns: repeat(1, 1fr); gap: 1.25rem; }
@media (min-width: 768px) { .grid-2-col { grid-template-columns: repeat(2, 1fr); } }
.grid-3-col { display: grid; grid-template-columns: repeat(1, 1fr); gap: 1rem; }
@media (min-width: 768px) { .grid-3-col { grid-template-columns: repeat(3, 1fr); gap: 1.25rem; } }


/* --- Header --- */
.header {
    background-color: var(--header-bg);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 40;
    transition: background-color 0.3s, border-color 0.3s;
}
.header-content { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1rem; }
.logo { font-size: 1.375rem; font-weight: 700; display: flex; align-items: center; letter-spacing: -0.5px; }
.logo-icon { color: var(--primary-color); margin-right: 0.75rem; }
#logged-in-view { display: flex; align-items: center; gap: 0.75rem; }
.user-email { font-size: 0.875rem; font-weight: 500; color: var(--text-light); }

.user-expiry {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background-color: var(--secondary-btn-bg);
    color: var(--secondary-btn-text);
    line-height: 1;
    white-space: nowrap;
}
.user-expiry.expired {
    background-color: #fee2e2; /* red-100 */
    color: #991b1b; /* red-800 */
}
.user-expiry.active {
    background-color: #dcfce7; /* green-100 */
    color: #166534; /* green-800 */
}

body.dark .user-expiry.expired {
    background-color: #450a0a;
    color: #fecaca;
}
body.dark .user-expiry.active {
    background-color: #052e16;
    color: #bbf7d0;
}

@media (max-width: 768px) { .user-email { display: none; } }

/* --- Card --- */
.card {
    background-color: var(--card-bg);
    padding: 1.5rem 2rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: background-color 0.3s, border-color 0.3s;
}
.card-header {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 -2rem 1rem;
    padding: 0 2rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* --- Forms --- */
.form-group { margin-top: 1.25rem; }
.form-label { display: block; margin-bottom: 0.5rem; font-size: 0.875rem; font-weight: 600; color: var(--text-dark); }
.sub-label { font-size: 0.8rem; color: var(--text-light); }
.input-style {
    display: block; width: 100%;
    box-sizing: border-box;
    padding: 0.6rem 0.9rem;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.3s, color 0.3s;
    color: var(--text-dark);
}
.input-style:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--ring-color);
}
.button-group { display: flex; gap: 0.75rem; margin-top: 1.5rem; }
.full-width { width: 100%; }
.material-form { border-bottom: 1px solid var(--border-color); padding-bottom: 2rem; margin-bottom: 2rem; }
.form-divider {
    border: none;
    border-top: 1px dashed var(--border-color);
    margin: 2rem 0;
}

/* Form Section */
.form-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}
.form-section.no-top-border {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}
.form-section-header {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 1.5rem 0;
    display: flex;
    align-items: center;
}


/* --- Accessory Adder --- */
.accessory-adder { display: flex; align-items: center; gap: 0.5rem; }
.accessory-qty { width: 4rem; text-align: center; }
.accessory-add-btn { height: 2.5rem; flex-shrink: 0; }
.accessory-list { margin-top: 1rem; list-style-type: none; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.accessory-list li {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.875rem;
    background-color: var(--accessory-bg);
    padding: 0.5rem 0.75rem; border-radius: 0.375rem;
    gap: 0.75rem;
}
.accessory-list li .flex-grow { flex-grow: 1; color: var(--text-dark); }
.accessory-list-qty {
    width: 4.5rem;
    padding: 0.25rem 0.5rem;
    text-align: center;
    box-sizing: border-box;
    display: inline-block;
    height: 2.2rem;
    flex-shrink: 0;
}
.accessory-unit {
    color: var(--text-light);
    font-size: 0.875rem;
    width: 3rem;
    flex-shrink: 0;
}
.remove-acc-btn, .remove-component-btn {
    background: none; border: none; color: var(--danger-color); cursor: pointer;
    font-size: 1rem; line-height: 1;
    width: 2rem; height: 2rem; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}
.remove-acc-btn:hover, .remove-component-btn:hover { background-color: #fee2e2; }
body.dark .remove-acc-btn:hover, body.dark .remove-component-btn:hover { background-color: rgba(127, 29, 29, 0.5); }


/* --- Image Uploader --- */
.remove-image-btn {
    position: absolute; top: 8px; right: 8px;
    width: 28px; height: 28px;
    border-radius: 50%; background-color: rgba(255, 255, 255, 0.9);
    color: var(--text-dark); border: 1px solid var(--border-color);
    font-size: 1.2rem; line-height: 1;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer; transition: all 0.2s; z-index: 10;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.remove-image-btn:hover { background-color: white; transform: scale(1.1); }
body.dark .remove-image-btn { background-color: var(--card-bg); color: var(--text-dark); border-color: var(--border-hover-color); }

/* --- Buttons --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.6rem 1.2rem; border: 1px solid transparent;
    font-size: 0.875rem; font-weight: 600; border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
    outline: none; transition: all 0.2s ease-in-out;
    cursor: pointer;
}
.btn i { margin-right: 0.5rem; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring-color); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.75rem; }
.btn-primary { color: white; background-color: var(--primary-color); border-color: var(--primary-color); }
.btn-primary:hover:not(:disabled) { background-color: var(--primary-hover); }
.btn-secondary { color: var(--secondary-btn-text); background-color: var(--secondary-btn-bg); border-color: var(--border-color); }
.btn-secondary:hover:not(:disabled) { background-color: var(--secondary-btn-hover-bg); }
.btn-success { color: white; background-color: var(--success-color); border-color: var(--success-color); }
.btn-success:hover:not(:disabled) { background-color: var(--success-hover); }
.btn-danger { color: white; background-color: var(--danger-color); border-color: var(--danger-color); }
.btn-danger:hover:not(:disabled) { background-color: var(--danger-hover); }

.main-actions-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}
.main-actions-group .btn {
    width: 100%;
}
@media (min-width: 768px) {
    .main-actions-group {
        flex-direction: row;
        justify-content: flex-end;
    }
    .main-actions-group .btn {
        width: auto;
    }
    .main-actions-group > .btn:first-child {
        margin-right: auto;
    }
}


/* --- NEW: Dashboard Layout --- */
.dashboard-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
    align-items: flex-start;
    padding: 1rem;
    padding-bottom: 5rem; /* Add space for sticky header */
    width: 100%;
    box-sizing: border-box;
}

.sidebar {
    position: sticky;
    top: 5.5rem; /* Approx header height + gap */
    align-self: start;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 7rem);
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    margin-bottom: 0.25rem;
}

.sidebar-link i.fa-fw {
    width: 20px;
    margin-right: 0.75rem;
    text-align: center;
}

.sidebar-link:hover {
    background-color: var(--app-bg);
    color: var(--text-dark);
}

.sidebar-link.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(55, 48, 163, 0.2), 0 2px 4px -2px rgba(55, 48, 163, 0.12);
}

.sidebar-link.active:hover {
    background-color: var(--primary-hover);
}

.main-content {
    min-width: 0; /* Prevents overflow issues in grid children */
    position: relative; /* Containing block for the overlay */
}

@media (max-width: 1024px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: relative;
        top: 0;
        display: flex;
        flex-direction: row;
        height: auto;
        overflow-x: auto;
        padding: 0.5rem;
        background-color: var(--card-bg);
        border: 1px solid var(--border-color);
        border-radius: 0.75rem;
        -ms-overflow-style: none;  /* IE and Edge */
        scrollbar-width: none;  /* Firefox */
    }
    .sidebar::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
    }
    .sidebar-link {
        flex-shrink: 0;
    }
}

@media (max-width: 768px) {
    .sidebar-link span {
        display: none;
    }
    .sidebar-link {
        justify-content: center;
        padding: 0.75rem;
    }
    .sidebar-link i.fa-fw {
        margin-right: 0;
    }
    .dashboard-layout {
        padding: 0.5rem;
        padding-bottom: 5rem;
    }
    .card {
        padding: 1rem;
    }
    .card-header {
        margin: 0 -1rem 1rem;
        padding: 0 1rem 1rem;
    }
}


/* --- Tab Pane --- */
.tab-pane { animation: fadeIn 0.5s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- Combobox --- */
.combobox-container {
    position: relative;
    width: 100%;
    flex-grow: 1; /* For accessory adder */
}
.combobox-options-wrapper {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-md);
    z-index: 100;
    max-height: 250px;
    overflow-y: auto;
}
.combobox-options-wrapper.show {
    display: block;
}
.combobox-options {
    list-style: none;
    padding: 0.5rem;
    margin: 0;
}
.combobox-option {
    padding: 0.6rem 0.9rem;
    cursor: pointer;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-dark);
}
.combobox-option:hover, .combobox-option.highlighted {
    background-color: var(--combobox-hover-bg);
    color: var(--primary-color);
}
body.dark .combobox-option:hover, body.dark .combobox-option.highlighted {
    color: var(--text-white);
}

.combobox-option.no-results {
    color: var(--text-light);
    cursor: default;
}
.qc-accessory-adder {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 0.5rem;
}


/* --- Tables --- */
.table-container { margin-top: 0.5rem; }
.table-wrapper { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.table-header { font-size: 1.25rem; font-weight: 600; margin-bottom: 1rem; color: var(--text-dark); }
.th-style {
    padding: 0.75rem 1rem; text-align: left;
    font-size: 0.75rem; font-weight: 600; color: var(--text-light);
    text-transform: uppercase; letter-spacing: 0.05em;
    background-color: var(--table-header-bg);
    border-bottom: 1px solid var(--border-color);
}
td { padding: 1rem; font-size: 0.875rem; color: var(--text-light); border-bottom: 1px solid var(--border-color); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) { background-color: var(--table-row-even-bg); }
.tag-type {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
    background-color: #eef2ff;
    color: #4338ca;
}
body.dark .tag-type { background-color: #312e81; color: #c7d2fe; }

.text-center { text-align: center; }
.text-right { text-right: right; }
.font-semibold { font-weight: 600; color: var(--text-dark); }
td button { transition: color 0.2s; }
.text-blue-500 { color: var(--primary-color); }
.hover\:text-blue-700:hover { color: var(--primary-hover); }
.text-red-500 { color: var(--danger-color); }
.hover\:text-red-700:hover { color: var(--danger-hover); }
.text-green-500 { color: var(--success-color); }
.hover\:text-green-700:hover { color: var(--success-hover); }
.text-purple-500 { color: #8b5cf6; }
.hover\:text-purple-700:hover { color: #7c3aed; }


/* --- Component Table --- */
.component-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}
.component-table {
    white-space: nowrap;
}
.component-table .th-delete { width: 5%; }

.component-table td {
    padding: 0.25rem 0.5rem;
    vertical-align: top;
}
.component-table .input-style {
    padding: 0.4rem 0.6rem;
    font-size: 0.875rem;
}
.component-table .combobox-container {
    min-height: 35px; /* Ensure row height is consistent */
}
.component-table .combobox-option {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
}

/* Component Group Adder */
.component-group-adder {
    background-color: var(--app-bg);
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border-color);
}
.component-group-adder .form-label {
    margin-top: 0;
    margin-bottom: 0.75rem;
}


/* --- Material List Controls --- */
.material-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    margin-top: -0.5rem;
}
.filter-wrapper {
    flex-grow: 1;
    position: relative;
}
.filter-wrapper .fa-search {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0.9rem;
    color: var(--text-light);
    pointer-events: none;
}
.filter-wrapper .input-style {
    padding-left: 2.5rem;
}
#material-sort-select {
    flex-grow: 1;
    min-width: 200px;
}

@media (min-width: 768px) {
    .material-controls {
        flex-wrap: nowrap;
    }
    .filter-wrapper {
        flex-grow: 2; /* takes more space */
    }
    #material-sort-select {
        flex-grow: 1;
        max-width: 250px;
    }
}


/* --- Responsive Tables --- */
@media (max-width: 768px) {
    .data-table:not(.component-table) thead { display: none; }
    .data-table:not(.component-table), .data-table:not(.component-table) tbody, .data-table:not(.component-table) tr, .data-table:not(.component-table) td { display: block; width: 100%; }
    .data-table:not(.component-table) tr {
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 0.75rem;
        padding: 0.5rem;
        background-color: var(--card-bg);
    }
    .data-table:not(.component-table) td {
        display: flex; justify-content: space-between; align-items: center;
        padding: 0.75rem 0.5rem; text-align: right;
        border-bottom: 1px dashed var(--border-color);
    }
    .data-table:not(.component-table) tr td:last-child { border-bottom: none; }
    .data-table:not(.component-table) td::before {
        content: attr(data-label);
        font-weight: 600;
        text-align: left;
        margin-right: 1rem;
        color: var(--text-dark);
    }
    .data-table:not(.component-table) td.text-center { justify-content: flex-end; }
}

/* --- Result Display --- */
#price-summary-container { margin-top: 1.5rem; }
.price-card { 
    border: 1px solid; 
    padding: 1.25rem; 
    border-radius: 0.75rem; 
    text-align: center; 
    transition: all 0.3s ease-in-out;
}
.price-label { font-size: 0.875rem; font-weight: 600; }
.price-value {
    font-size: clamp(1.75rem, 4vw, 1.5rem);
    font-weight: 700;
    line-height: 1.1;
    margin: 0.5rem 0;
    overflow-wrap: break-word;
    word-break: break-word; /* For wider compatibility */
}
.price-sublabel { font-size: 0.8rem; color: var(--text-light); }
.bg-indigo { background-color: #eef2ff; border-color: #c7d2fe; }
.bg-indigo .price-label { color: #3730a3; }
.bg-indigo .price-value { color: var(--primary-color); }
.bg-green { background-color: #f0fdf4; border-color: #bbf7d0; }
.bg-green .price-label { color: #166534; }
.bg-green .price-value { color: var(--success-color); }
.bg-yellow { background-color: #fefce8; border-color: #fde047; }
.bg-yellow .price-label { color: #854d0e; }
.bg-yellow .price-value { color: #ca8a04; }

body.dark .bg-indigo { background-color: #2c2a63; border-color: #3730a3; }
body.dark .bg-indigo .price-label { color: #c7d2fe; }
body.dark .bg-indigo .price-value { color: #e0e7ff; }
body.dark .bg-green { background-color: #14532d; border-color: #22c55e; }
body.dark .bg-green .price-label { color: #bbf7d0; }
body.dark .bg-green .price-value { color: #86efac; }
body.dark .bg-yellow { background-color: #78350f; border-color: #a16207; }
body.dark .bg-yellow .price-label { color: #fef3c7; }
body.dark .bg-yellow .price-value { color: #fde047; }


.result-box { margin-top: 2rem; }
.result-box-header { font-size: 1.25rem; font-weight: 600; color: var(--text-dark); margin-bottom: 1rem; display: flex; align-items: center; gap: 0.75rem;}
.result-box-header i { color: var(--primary-color); }
.step-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    margin-right: 0.75rem;
}


/* --- Structured Analysis & Modal Content Styling --- */
.modal-body h4, .guide-details h4, #product-preview-section h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 1.25rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
}
.modal-body h4:first-child { margin-top: 0; }
.modal-body h4 i, .guide-details h4 i, #product-preview-section h4 i { margin-right: 0.5rem; }
.modal-body ul, .guide-details ul { list-style-type: none; padding-left: 1.5rem; margin: 0 0 1rem 0; }
.modal-body li, .guide-details li { position: relative; padding-bottom: 0.5rem; color: var(--text-dark); line-height: 1.6; }
.modal-body li::before, .guide-details li::before {
    content: '✓';
    position: absolute;
    left: -1.5rem;
    color: var(--success-color);
    font-weight: bold;
}
.modal-body p { color: var(--text-light); line-height: 1.6; margin: 0; }

.final-price-recommendation {
    background: linear-gradient(135deg, var(--primary-color) 0%, #4f46e5 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(55, 48, 163, 0.2), 0 4px 6px -2px rgba(55, 48, 163, 0.1);
}
.final-price-main {
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}
.final-price-label {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.final-price-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0.25rem 0 0.75rem 0;
    line-height: 1;
}
.final-price-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    text-align: center;
}
.breakdown-label {
    display: block;
    font-size: 0.8rem;
    opacity: 0.8;
    margin-bottom: 0.25rem;
}
.breakdown-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
}


/* --- Cost List (for initial and final breakdown) --- */
.cost-list {
    list-style-type: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow: hidden;
}
.cost-list li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}
.cost-list li:last-child { border-bottom: none; }
.cost-item-name { font-weight: 500; flex-grow: 1; margin-right: 1rem; color: var(--text-dark); }
.cost-item-value { font-weight: 600; color: var(--primary-color); white-space: nowrap; }
.cost-item-reason { width: 100%; font-size: 0.8rem; color: var(--text-light); margin-top: 0.25rem; padding-left: 0.25rem; font-style: italic; }

/* --- Modal --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    display: flex; justify-content: center; align-items: center;
    z-index: 1000; padding: 1rem;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease-out;
}
.modal-content {
    background-color: var(--card-bg); 
    color: var(--text-dark);
    padding: 2rem; border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    width: 90%; max-width: 450px; position: relative;
    animation: slideIn 0.3s ease-out;
}
.modal-content.modal-lg { max-width: 900px; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
.modal-close-btn {
    position: absolute; top: 10px; right: 15px;
    font-size: 1.8rem; color: #9ca3af; background: none;
    border: none; cursor: pointer; line-height: 1;
}
.modal-title { font-size: 1.5rem; font-weight: 700; text-align: center; margin-bottom: 1.5rem; color: var(--text-dark);}
.modal-title-sm { font-size: 1.125rem; font-weight: 600; color: var(--text-dark); margin-bottom: 0.5rem; }
.modal-body { white-space: normal; max-height: 75vh; overflow-y: auto; padding: 0 0.5rem; }
.error-message { color: var(--danger-color); font-size: 0.875rem; text-align: center; height: 1.25rem; margin-bottom: 1rem; }
.confirm-text { color: var(--text-light); margin-bottom: 1.5rem; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 0.75rem; }
.google-btn {
    display: flex; justify-content: center; align-items: center;
    padding: 0.6rem 1.2rem; border: 1px solid var(--border-color);
    border-radius: 0.5rem; background-color: var(--input-bg);
    color: var(--text-dark); font-weight: 500; cursor: pointer;
    transition: background-color 0.2s;
}
.google-btn img { margin-right: 0.75rem; }
.google-btn:hover { background-color: var(--app-bg); }
body.dark .google-btn:hover { background-color: var(--border-hover-color); }

.remember-me-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    gap: 0.5rem;
}
.remember-me-container label {
    font-size: 0.875rem;
    color: var(--text-light);
    user-select: none;
    cursor: pointer;
}
.remember-me-container input[type="checkbox"] {
    margin: 0;
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--primary-color);
    cursor: pointer;
}
.login-modal-content {
    padding: 2.5rem;
    text-align: center;
}
.login-modal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.login-modal-header .logo-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-right: 0;
}
.login-modal-content .modal-title {
    margin-bottom: 0;
    font-size: 1.375rem;
}
.modal-subtitle {
    color: var(--text-light);
    margin-top: 0;
    margin-bottom: 2rem;
    font-size: 0.95rem;
    line-height: 1.6;
}
.login-modal-content .google-btn {
    width: 100%;
    margin-bottom: 1rem;
    padding: 0.75rem 1.2rem;
    font-size: 0.95rem;
}
.login-modal-content .google-btn span {
    flex-grow: 1;
    text-align: center;
}
.login-modal-content .remember-me-container {
    justify-content: center;
    margin-top: 1.5rem;
    margin-bottom: 0;
}

/* --- Project Details Modal Grid --- */
.modal-details-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem 2rem;
    margin-top: 1.5rem;
}
@media (min-width: 768px) {
    .modal-details-grid {
        grid-template-columns: 1fr 1fr;
    }
}
.modal-details-col > *:first-child {
    margin-top: 0;
}
.modal-details-col .result-box {
    margin-top: 1.5rem;
    padding: 0;
    border: none;
}
.modal-details-col .result-box > h3.result-box-header {
    margin-top: 0;
}


/* --- Settings Form --- */
.settings-intro {
    background-color: #eef2ff;
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    color: #3730a3;
    border-radius: 0 0.5rem 0.5rem 0;
}
body.dark .settings-intro {
    background-color: rgba(55, 48, 163, 0.2);
    color: #a5b4fc;
}
.form-text {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* --- Loaders --- */
.loading-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--app-bg);
    display: flex; justify-content: center; align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease-in-out;
}
.spinner {
    width: 48px; height: 48px;
    border: 5px solid var(--border-color);
    border-bottom-color: var(--primary-color);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}
.spinner-sm {
    width: 16px; height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-bottom-color: white;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
    margin-right: 0.5rem;
}
#results-content.hidden { display: none; }


@keyframes rotation { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- Toast Notifications --- */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 1050; }
.toast {
    background-color: var(--card-bg); 
    color: var(--text-dark);
    padding: 15px 20px; border-radius: 8px;
    box-shadow: var(--shadow-md);
    margin-bottom: 10px;
    opacity: 0; transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    display: flex; align-items: center; min-width: 250px;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast--success { border-left: 5px solid var(--success-color); }
.toast--error { border-left: 5px solid var(--danger-color); }
.toast--info { border-left: 5px solid #17a2b8; }
.toast-icon { margin-right: 10px; font-size: 1.2rem; }
.toast--success .toast-icon { color: var(--success-color); }
.toast--error .toast-icon { color: var(--danger-color); }
.toast--info .toast-icon { color: #17a2b8; }

/* --- Footer --- */
.footer {
    text-align: center;
    margin-top: 3rem;
    padding: 1.5rem 1rem;
    border-top: 1px solid var(--border-color);
}
.footer p {
    color: var(--text-light);
    font-size: 0.875rem;
    margin: 0.25rem 0;
}
.footer a {
    color: var(--primary-color);
    font-weight: 500;
    text-decoration: none;
    transition: text-decoration 0.2s;
}
.footer a:hover {
    text-decoration: underline;
}

/* --- Utility --- */
.hidden { display: none !important; }
.mr-2 { margin-right: 0.5rem; }

/* --- Update Log --- */
.update-content { padding-top: 1rem; }
.update-entry {
    border-left: 3px solid var(--primary-color);
    padding-left: 1.5rem;
    margin-bottom: 2rem;
    position: relative;
}
.update-entry::before {
    content: '';
    position: absolute;
    left: -8px; /* half of width */
    top: 5px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--primary-color);
    border: 3px solid var(--app-bg);
}
.update-entry h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 0.5rem 0;
}
.update-version-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}
.update-version-link:hover {
    text-decoration: underline;
}
.update-entry ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.update-entry li {
    margin-bottom: 0.75rem;
    color: var(--text-light);
    line-height: 1.6;
    display: flex;
    align-items: flex-start;
}
.update-tag {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 999px;
    margin-right: 0.75rem;
    text-transform: uppercase;
    flex-shrink: 0;
    margin-top: 3px;
}
.update-tag.new { background-color: #e0f2fe; color: #075985; } /* sky-100, sky-800 */
.update-tag.update { background-color: #fef9c3; color: #854d0e; } /* yellow-100, yellow-800 */
.update-tag.fix { background-color: #dcfce7; color: #166534; } /* green-100, green-800 */
.update-tag.remove { background-color: #fee2e2; color: #991b1b; } /* red-100, red-800 */
#update-log-content .loading-overlay {
    position: relative; 
    background: none; 
    display: flex; 
    height: 200px;
    opacity: 1; /* override initial state */
}

.update-date {
    font-weight: 500;
    color: var(--text-light);
    font-size: 1rem;
    margin-left: 0.25rem;
}

.update-link-info {
    color: var(--text-light);
    font-size: 0.9rem;
    margin: 0;
    padding-left: 1px;
}

/* --- Product Preview --- */
#product-preview-section { margin-bottom: 1.5rem; }
.preview-canvas {
    width: 100%;
    height: 300px;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--app-bg);
    background-image:
        linear-gradient(rgba(100, 116, 139, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(100, 116, 139, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    overflow: hidden;
    position: relative;
    padding: 0.5rem;
    box-sizing: border-box;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}
.preview-canvas:hover {
    background-color: var(--combobox-hover-bg);
    border-color: var(--primary-color);
}


#sidebar-image-placeholder {
    text-align: center;
    color: var(--text-light);
}

#sidebar-image-placeholder i {
    font-size: 2rem;
    color: #cbd5e1;
    display: block;
    margin-bottom: 0.75rem;
}
body.dark #sidebar-image-placeholder i { color: var(--border-color); }

#sidebar-image-placeholder p {
    margin: 0;
    font-size: 0.875rem;
}

#sidebar-image-preview {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 0.375rem;
}

/* --- Pagination Controls --- */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}
.pagination-controls #page-info {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-light);
}
.pagination-controls .btn {
    padding: 0.5rem 1rem;
}
.pagination-controls .btn i {
    margin: 0;
}
.pagination-controls .btn[data-direction="prev"] i {
    margin-right: 0.4rem;
}
.pagination-controls .btn[data-direction="next"] i {
    margin-left: 0.4rem;
}

/* --- NEW: Config Tab Layout --- */
.config-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}
@media (min-width: 1024px) {
    .config-layout {
        grid-template-columns: minmax(320px, 1fr) 2fr;
    }
}
.config-list-panel {
    border-right: none;
    padding-right: 0;
}
@media (min-width: 1024px) {
    .config-list-panel {
        border-right: 1px solid var(--border-color);
        padding-right: 2rem;
    }
}
.config-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}
.config-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    color: var(--text-dark);
}
.config-list-item:hover {
    background-color: var(--combobox-hover-bg);
}
.config-list-item.active {
    background-color: #eef2ff;
    border-color: var(--primary-color);
    font-weight: 600;
    color: var(--primary-color);
}
body.dark .config-list-item.active {
    background-color: rgba(55, 48, 163, 0.2);
    color: #a5b4fc;
}
.config-list-item-actions button {
    background: none; border: none; cursor: pointer; color: var(--text-light);
    width: 28px; height: 28px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}
.config-list-item-actions button:hover {
    background-color: #e2e8f0;
    color: var(--text-dark);
}
body.dark .config-list-item-actions button:hover {
    background-color: var(--border-hover-color);
    color: var(--text-dark);
}

.config-list-item-actions .delete-pt-btn:hover,
.config-list-item-actions .delete-cg-btn:hover {
    background-color: #fee2e2;
    color: var(--danger-color);
}
.config-sub-header {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}
#pt-components-list .remove-component-btn,
#cg-components-list .remove-cg-component-btn {
    color: var(--text-light);
}
#pt-components-list .remove-component-btn:hover,
#cg-components-list .remove-cg-component-btn:hover {
    color: var(--danger-color);
    background-color: #fee2e2;
}

/* --- NEW: Edge Banding Rules --- */
.edge-banding-rules {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
}
.edge-banding-rules label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    user-select: none;
}
.edge-banding-rules input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary-color);
}
.edge-banding-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.75rem;
}
.edge-banding-icon.on {
    background-color: var(--success-color);
    color: white;
}
.edge-banding-icon.off {
    background-color: #e2e8f0;
    color: var(--text-light);
}
body.dark .edge-banding-icon.off {
    background-color: var(--border-color);
    color: var(--text-light);
}
.edge-banding-cell {
    display: flex;
    justify-content: center;
    gap: 0.3rem;
}

/* --- NEW: Tooltip Icons --- */
.tooltip-icon-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.5rem;
}

.card-header > .tooltip-icon-wrapper {
    font-size: 1rem; /* make it smaller than the header text */
}

.tooltip-icon {
    color: var(--text-light);
    cursor: help;
    font-size: 0.9rem;
    transition: color 0.2s;
}
.tooltip-icon:hover {
    color: var(--primary-color);
}
.tooltip-text {
    visibility: hidden;
    width: 250px;
    background-color: var(--text-dark);
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 0.75rem;
    position: absolute;
    z-index: 10;
    bottom: 150%;
    left: 50%;
    margin-left: -125px; /* Half of width */
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.5;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    pointer-events: none; /* Add this so it doesn't interfere with hover state */
}
body.dark .tooltip-text {
    background-color: var(--card-bg);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}
.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--text-dark) transparent transparent transparent;
}
body.dark .tooltip-text::after {
    border-color: var(--card-bg) transparent transparent transparent;
}
.tooltip-icon-wrapper:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* to align tooltip icon with labels */
.form-label, .card-header, .form-section-header, .table-header {
    display: flex;
    align-items: center;
}

textarea.input-style {
    min-height: 80px;
    resize: vertical;
}

.project-name-main {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.project-details-list {
    font-size: 0.8rem;
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-left: 0.25rem;
}

.project-detail-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.project-detail-item i.fa-fw {
    width: 14px;
    text-align: center;
    color: var(--text-light);
}

.project-description {
    font-style: italic;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-color);
    white-space: pre-wrap;
    word-break: break-word;
    max-width: 100%;
}

@media (max-width: 768px) {
    .data-table:not(.component-table) td[data-label^="Tên"] {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    .data-table:not(.component-table) td[data-label^="Tên"]::before {
        margin-bottom: 0.5rem;
    }
    .project-name-main, .project-details-list {
        width: 100%;
    }
}

/* Admin Update Log Styles */
#admin-update-log-list .card {
    border: 1px solid #f1f5f9;
    box-shadow: none;
    padding: 1.5rem;
    background-color: #f8fafc;
}
#admin-update-log-list h4 {
    color: var(--text-dark);
}
#admin-update-log-list .delete-version-btn {
    flex-shrink: 0;
}
#admin-update-log-list .delete-update-item-btn {
    font-size: 1rem;
    color: var(--text-light);
}
#admin-update-log-list .delete-update-item-btn:hover {
    color: var(--danger-color);
    background-color: #fee2e2;
}
#admin-update-log-list .cost-list {
    background-color: var(--card-bg);
}

/* --- Inactive User Overlay --- */
.global-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(248, 250, 252, 0.9);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
    box-sizing: border-box;
    animation: fadeIn 0.3s;
}
body.dark .global-overlay {
    background-color: rgba(17, 24, 39, 0.9);
}

.overlay-content {
    max-width: 500px;
}
.overlay-icon {
    font-size: 3rem;
    color: var(--danger-color);
    margin-bottom: 1.5rem;
}
.overlay-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
}
.overlay-content p {
    color: var(--text-light);
    margin-bottom: 2rem;
    line-height: 1.6;
}
.modal-image-preview {
    width: 100%;
    max-height: 300px;
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
    overflow: hidden;
    background-color: var(--app-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--border-color);
}
.modal-image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* --- Theme Toggle --- */
.theme-toggle-container {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 1010;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--secondary-btn-hover-bg);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid var(--border-color);
}

.theme-slider:before {
    position: absolute;
    height: 26px;
    width: 26px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
    /* Icon styles */
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 14px;
    /* Light mode icon (sun) */
    content: "\f185";
    color: #f59e0b;
}

body.dark .theme-slider {
    background-color: var(--primary-hover);
}

input:checked + .theme-slider:before {
    transform: translateX(26px);
    /* Dark mode icon (moon) */
    content: "\f186";
    color: #a5b4fc;
}

/* --- Payment Info on Overlay --- */
#inactive-overlay-payment-info {
    margin: 2rem 0;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--border-color);
}

.payment-details {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-direction: column;
}

@media (min-width: 768px) {
    .payment-details {
        flex-direction: row;
        align-items: flex-start;
    }
}

.qr-code-wrapper {
    text-align: center;
    flex-shrink: 0;
}

.qr-code-wrapper img {
    width: 180px;
    height: 180px;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.qr-bank-info {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    margin-top: 0.5rem;
}

.payment-instructions {
    text-align: left;
}

.payment-instructions p {
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-dark);
}

.payment-instructions strong {
    color: var(--text-dark);
}

.transfer-email {
    font-weight: 700;
    color: var(--primary-color);
    background-color: var(--secondary-btn-bg);
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    display: inline-block;
    user-select: all;
}

.payment-instructions .payment-notice {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 1rem;
}
.payment-notice i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

/* --- Sidebar Column Layout --- */
.sidebar-column {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* --- YouTube Video Link --- */
.youtube-link-wrapper {
    display: block;
    position: relative;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer;
}

.youtube-link-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.youtube-thumbnail {
    width: 100%;
    display: block;
}

.play-button-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
}

.youtube-link-wrapper:hover .play-button-overlay {
    background-color: rgba(0, 0, 0, 0.2);
}

.play-button-overlay .fa-youtube {
    font-size: 4rem;
    color: #ff0000;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    transition: transform 0.2s ease-in-out;
}

.youtube-link-wrapper:hover .play-button-overlay .fa-youtube {
    transform: scale(1.1);
}

/* --- Saved Projects Filter Restyling --- */
#saved-tab .material-controls {
    display: grid;
    grid-template-columns: 1fr; /* Mobile first */
    gap: 1rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
    align-items: end;
}

#saved-tab .material-controls .form-group {
    margin: 0;
}

#saved-tab .material-controls .form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
    #saved-tab .material-controls {
        grid-template-columns: 1fr 1fr; /* Two columns on larger screens */
        gap: 1rem 1.5rem;
    }
    
    /* Make search span full width on grid */
    #saved-tab .material-controls .form-group:first-child {
        grid-column: 1 / -1;
    }
}