:root {
    --bg-color: #faf9f9;
    --card-bg: rgba(255, 255, 255, 0.9);
    --primary-color: #50b3d7;
    --secondary-color: #c1d040;
    --accent-color: #f7be5d;
    --text-color: #2c3e50;
    --text-muted: #6b7c93;
    --border-color: #e0e0e0;
    --hover-bg: rgba(80, 179, 215, 0.1);
    --success-color: #c1d040;
    --danger-color: #e74c3c;
    --glass-border: 1px solid rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    background-image: radial-gradient(circle at 10% 20%, rgba(80, 179, 215, 0.08) 0%, transparent 25%),
        radial-gradient(circle at 90% 80%, rgba(193, 208, 64, 0.08) 0%, transparent 25%);
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
    position: relative;
}

.header-logo {
    position: fixed;
    top: 1rem;
    left: 1rem;
    height: 120px;
    width: auto;
    object-fit: contain;
    z-index: 100;
}

header h1 {
    font-size: 2.5rem;
    background: linear-gradient(120deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    font-weight: 800;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* User Menu */
.user-menu {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 100;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.user-info i {
    font-size: 1.2rem;
    color: var(--primary-color);
}

.role-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.role-badge.admin {
    background: linear-gradient(135deg, var(--secondary-color), #a8b838);
    color: white;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: rgba(231, 76, 60, 0.1);
    color: #c0392b;
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: rgba(231, 76, 60, 0.2);
    border-color: rgba(231, 76, 60, 0.5);
}

/* Mini buttons for tables */
.mini-btn {
    padding: 0.4rem 0.6rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    background: rgba(80, 179, 215, 0.1);
    color: var(--primary-color);
    margin: 0 0.2rem;
}

.mini-btn:hover {
    background: rgba(80, 179, 215, 0.2);
}

.mini-btn.delete-user-btn {
    background: rgba(231, 76, 60, 0.1);
    color: #c0392b;
}

.mini-btn.delete-user-btn:hover {
    background: rgba(231, 76, 60, 0.2);
}

.role-badge.user {
    background: rgba(80, 179, 215, 0.2);
    color: var(--primary-color);
}

/* Admin FAB */
.fab.admin-fab {
    background: linear-gradient(135deg, #6b7c93, #5a6a7d);
    box-shadow: 0 4px 15px rgba(107, 124, 147, 0.4);
}

.fab.admin-fab:hover {
    box-shadow: 0 6px 20px rgba(107, 124, 147, 0.5);
}

/* Glassmorphism Card Style */
.upload-section,
.chart-section,
.history-section {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    transition: transform 0.3s ease;
}

/* Upload Drop Zone */
.drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    background: #ffffff;
}

.drop-zone--over {
    border-color: var(--primary-color);
    background-color: var(--hover-bg);
}

.drop-zone__input {
    display: none;
}

.drop-zone__icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: block;
}

.drop-zone__prompt {
    font-size: 1.2rem;
    color: var(--text-muted);
}

/* Accordion Styles */
.accordion {
    width: 100%;
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.accordion-content.open {
    max-height: 1000px;
}

.arrow {
    transition: transform 0.3s ease;
}

.accordion-header.active .arrow {
    transform: rotate(180deg);
}


.loading-spinner {
    display: none;
    border: 4px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border-left-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* History List */
.history-section h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    color: var(--text-color);
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
    cursor: pointer;
}

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

.history-item:hover {
    background-color: var(--hover-bg);
}

.history-name {
    font-weight: 500;
}

.history-date {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hidden {
    display: none !important;
}

/* --- Phase 2: Site Management Styles --- */

/* Search Bar */
.search-container {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: var(--glass-border);
    border-radius: 30px;
    padding: 0.8rem 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.search-icon {
    color: var(--primary-color);
    margin-right: 1rem;
    font-size: 1.2rem;
}

.search-input {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.1rem;
    width: 100%;
    outline: none;
    font-family: inherit;
}

/* Site Grid */
.site-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    padding-bottom: 5rem;
}

.site-card {
    background: var(--card-bg);
    border: var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s;
    position: relative;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.site-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(80, 179, 215, 0.15);
}

.site-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.site-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.site-creator {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.delete-site-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.4rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    opacity: 0;
    z-index: 10;
}

.site-card:hover .delete-site-btn {
    opacity: 1;
}

.delete-site-btn:hover {
    color: var(--danger-color);
    transform: scale(1.2);
}

/* FAB */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #4aa3c5);
    color: white;
    border: none;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(80, 179, 215, 0.4);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 20px rgba(80, 179, 215, 0.5);
}

/* Detailed View */
.detail-header {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
}

.back-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    margin-right: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.back-btn:hover {
    color: var(--primary-color);
}

/* Tabs */
.tabs-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem 1rem;
    position: relative;
    transition: color 0.2s;
}

.tab-btn:hover {
    color: var(--text-color);
}

.tab-btn.active {
    color: var(--primary-color);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -0.6rem;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
    border-radius: 2px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.modal-content h3 {
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.modal-content input {
    width: 100%;
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #faf9f9;
    color: var(--text-color);
    margin-bottom: 1.5rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.modal-content input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(80, 179, 215, 0.1);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.modal-actions button {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.modal-actions button:hover {
    transform: translateY(-1px);
}

#cancel-add-site {
    background: transparent;
    color: var(--text-muted);
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary-color), #4aa3c5);
    color: white;
    box-shadow: 0 4px 10px rgba(80, 179, 215, 0.3);
}

.danger-btn {
    background: var(--danger-color);
    color: white;
}

/* Chart Overlay */
.chart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    overflow: hidden;
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chart-content {
    background: #ffffff;
    border: var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    width: 95vw;
    height: 90vh;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

.chart-content h3 {
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.chart-container {
    padding-top: 0.5rem;
    text-align: center;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    position: relative;
}

.chart-image {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: none;
    transition: transform 0.2s ease;
    transform-origin: center center;
    cursor: grab;
}

.chart-image:active {
    cursor: grabbing;
}

.chart-controls {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.chart-controls button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-color);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chart-controls button:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
}

.close-chart {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
    z-index: 10;
}

.close-chart:hover {
    color: var(--danger-color);
}

/* Category Uploads */
.category-section {
    margin-bottom: 2rem;
}

.category-header {
    background: rgba(80, 179, 215, 0.08);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mini-upload-btn {
    background: var(--border-color);
    color: var(--text-color);
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.mini-upload-btn:hover {
    background: var(--primary-color);
    color: white;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.file-item {
    background: rgba(80, 179, 215, 0.04);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    text-align: left;
    transition: background 0.2s;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    white-space: nowrap;
    width: 100%;
}

.file-item .file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    display: block;
}

.file-item:hover {
    background: rgba(80, 179, 215, 0.1);
}

.file-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-left: auto;
}

.m1-value {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
}

.m1-value.m1-pass {
    background: rgba(40, 167, 69, 0.2);
    color: #28a745;
}

.m1-value.m1-fail {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

.chart-btn {
    padding: 0.4rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
}

.chart-btn:hover {
    color: var(--primary-color);
    transform: scale(1.2);
}

.delete-file-btn {
    padding: 0.4rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
}

.delete-file-btn:hover {
    color: var(--danger-color);
    transform: scale(1.2);
}

/* Custom Tooltips */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    pointer-events: none;
    margin-top: 5px;
    z-index: 100;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Picture Gallery */
.picture-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem;
}

.thumbnail-item {
    background: var(--card-bg);
    border: var(--glass-border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.thumbnail-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(80, 179, 215, 0.15);
}

.thumbnail-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.thumbnail-name {
    padding: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.delete-thumb-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.thumbnail-item:hover .delete-thumb-btn {
    opacity: 1;
}

.delete-thumb-btn:hover {
    background: var(--danger-color);
}

/* Sector Badge */
.sector-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(80, 179, 215, 0.9);
    color: white;
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.sector-badge.alpha {
    background: rgba(80, 179, 215, 0.9);
}

.sector-badge.beta {
    background: rgba(193, 208, 64, 0.9);
    color: #333;
}

.sector-badge.gamma {
    background: rgba(247, 190, 93, 0.9);
    color: #333;
}

.sector-badge.unknown {
    background: rgba(231, 76, 60, 0.9);
    cursor: pointer;
    transition: all 0.2s;
}

.sector-badge.unknown:hover {
    background: rgba(192, 57, 43, 1);
    transform: scale(1.1);
}

/* PIM Data Table */
.table-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.refresh-btn,
.download-btn {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.refresh-btn:hover,
.download-btn:hover {
    background: var(--hover-bg);
    transform: translateY(-2px);
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(80, 179, 215, 0.15);
}

.download-btn {
    margin-right: 0.75rem;
}

.download-btn i {
    color: #4caf50;
}

.refresh-btn i {
    transition: transform 0.4s ease;
}

.refresh-btn:hover i {
    transform: rotate(180deg);
}

.table-wrapper {
    overflow-x: auto;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-top: 1rem;
}

.pim-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    color: var(--text-color);
}

.pim-data-table th,
.pim-data-table td {
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    text-align: center;
    white-space: nowrap;
}

.pim-data-table th {
    background: linear-gradient(135deg, var(--primary-color), #4aa3c5);
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.pim-data-table tr:nth-child(even) {
    background: rgba(80, 179, 215, 0.04);
}

.pim-data-table tr:hover {
    background: rgba(193, 208, 64, 0.08);
}

.pim-data-table .num {
    font-family: 'Roboto Mono', monospace;
    font-weight: 500;
}

/* Status colors */
.status-pass {
    background: rgba(193, 208, 64, 0.2) !important;
    color: #6b7a1a;
    font-weight: bold;
}

.status-fail {
    background: rgba(247, 190, 93, 0.25) !important;
    color: #b5751a;
    font-weight: bold;
}

.status-highlight {
    background: rgba(193, 208, 64, 0.4) !important;
    color: #4a5a10;
    font-weight: bold;
}

.text-danger {
    color: var(--danger-color);
    font-weight: bold;
}

/* Form Tab Styles */
.form-container {
    max-width: 1200px;
    margin: 0 auto;
}

.form-section {
    background: var(--card-bg);
    border: var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.form-section h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.form-field {
    display: flex;
    flex-direction: column;
}

.form-field label {
    color: var(--text-color);
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-field input {
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-color);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-field input::placeholder {
    color: #c0c8d0;
    font-weight: 300;
    font-style: italic;
}

.form-field input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(80, 179, 215, 0.1);
}

.save-btn {
    background: linear-gradient(135deg, var(--secondary-color), #a8b838);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(193, 208, 64, 0.3);
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(193, 208, 64, 0.4);
}

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

.measurement-form-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    color: var(--text-color);
}

.measurement-form-table th,
.measurement-form-table td {
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border-color);
    text-align: center;
}

.measurement-form-table th {
    background: linear-gradient(135deg, var(--primary-color), #4aa3c5);
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.measurement-form-table tr:nth-child(even) {
    background: rgba(80, 179, 215, 0.04);
}

.measurement-form-table .test-name {
    text-align: left;
    font-weight: 500;
    color: var(--text-color);
}

.measurement-form-table .form-input {
    width: 100%;
    padding: 0.4rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    font-size: 0.85rem;
    text-align: center;
}

.measurement-form-table .form-input::placeholder {
    color: #c0c8d0;
    font-weight: 300;
    font-style: italic;
}

.measurement-form-table .form-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Collapsible Category Sections */
.category-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
}

.category-toggle-icon {
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

.category-toggle-icon.rotated {
    transform: rotate(-90deg);
}

.category-content {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease;
    opacity: 1;
    margin-top: 1rem;
}

.category-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

/* Missing field highlight - indicates N/A value in table */
.missing-field {
    background-color: #fff3cd !important;
    border-left: 3px solid #ffc107 !important;
}

.missing-field input {
    background-color: #fffbe6 !important;
}

/* ========== Report Tab - PPTX Preview Styles ========== */

.report-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.report-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 12px;
    border: var(--glass-border);
}

.report-controls-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.report-controls-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.report-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.report-btn.refresh-btn {
    background: linear-gradient(135deg, var(--primary-color), #4aa3c5);
    color: white;
    box-shadow: 0 4px 10px rgba(80, 179, 215, 0.3);
}

.report-btn.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(80, 179, 215, 0.4);
}

.report-btn.export-btn {
    background: linear-gradient(135deg, var(--secondary-color), #a8b838);
    color: white;
    box-shadow: 0 4px 10px rgba(193, 208, 64, 0.3);
}

.report-btn.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(193, 208, 64, 0.4);
}

.report-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Slide Navigation */
.slide-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.slide-nav-btn {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.slide-nav-btn:hover:not(:disabled) {
    background: var(--hover-bg);
    border-color: var(--primary-color);
}

.slide-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.slide-counter {
    font-size: 0.9rem;
    color: var(--text-muted);
    min-width: 80px;
    text-align: center;
}

/* Slide Preview Container */
.slides-preview {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Individual Slide */
.slide-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.slide-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.slide {
    width: 100%;
    max-width: 960px;
    aspect-ratio: 16 / 9;
    background: #ffffff;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.slide.active {
    border-color: var(--primary-color);
    box-shadow: 0 8px 30px rgba(80, 179, 215, 0.25);
}

/* Slide Header */
.slide-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.slide-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.slide-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.slide-logo {
    width: 80px;
    height: auto;
    opacity: 0.7;
}

/* Slide Content */
.slide-content {
    flex: 1;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

/* Slide Table */
.slide-table-wrapper {
    flex: 1;
    overflow: auto;
}

.slide-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.slide-table th,
.slide-table td {
    padding: 0.4rem 0.5rem;
    border: 1px solid #ddd;
    text-align: center;
    white-space: nowrap;
}

.slide-table th {
    background: linear-gradient(135deg, var(--primary-color), #4aa3c5);
    color: white;
    font-weight: 600;
    font-size: 0.7rem;
    position: sticky;
    top: 0;
    z-index: 5;
}

.slide-table tr:nth-child(even) {
    background: rgba(80, 179, 215, 0.04);
}

.slide-table tr:hover {
    background: rgba(193, 208, 64, 0.1);
}

/* Editable cells in slide table */
.slide-table .editable-cell {
    background: transparent;
    border: 1px solid transparent;
    text-align: center;
    font-size: 0.75rem;
    padding: 0.2rem;
    width: 100%;
    color: var(--text-color);
    transition: all 0.2s;
}

.slide-table .editable-cell:hover {
    border-color: var(--border-color);
    background: #fafafa;
}

.slide-table .editable-cell:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(80, 179, 215, 0.2);
}

.slide-table .editable-cell.modified {
    background: rgba(247, 190, 93, 0.2);
    border-color: var(--accent-color);
}

/* Status colors in slide table */
.slide-table .status-pass {
    background: rgba(193, 208, 64, 0.25);
    color: #5a6a15;
    font-weight: 600;
}

.slide-table .status-fail {
    background: rgba(231, 76, 60, 0.15);
    color: #c0392b;
    font-weight: 600;
}

/* Slide Footer */
.slide-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

.slide-footer-logo {
    height: 24px;
    width: auto;
    opacity: 0.8;
}

/* Slide navigation - compact numbered pills */
.slides-thumbnails {
    display: flex;
    gap: 0.35rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

.slides-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.slides-thumbnails::-webkit-scrollbar-track {
    background: transparent;
}

.slides-thumbnails::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.slide-thumbnail {
    min-width: 36px;
    height: 36px;
    background: #ffffff;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    flex-shrink: 0;
}

.slide-thumbnail:hover {
    border-color: var(--primary-color);
    background: rgba(80, 179, 215, 0.1);
    transform: scale(1.1);
}

.slide-thumbnail.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(80, 179, 215, 0.4);
}

/* Slide dropdown selector */
.slide-select {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #fff;
    font-size: 0.85rem;
    color: var(--text-color);
    cursor: pointer;
    min-width: 180px;
}

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

/* Empty slide state */
.slide-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
}

.slide-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.slide-empty p {
    font-size: 1rem;
}

/* ========== Mobile Responsive Styles ========== */

@media screen and (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    /* Header */
    .header-logo {
        height: 60px !important;
        top: 0.5rem !important;
        left: 0.5rem !important;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    header p {
        font-size: 0.9rem;
    }
    
    /* User Menu */
    .user-menu {
        top: 0.5rem;
        right: 0.5rem;
        gap: 0.5rem;
    }
    
    .user-info {
        display: none;
    }
    
    .logout-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    /* Search */
    .search-container {
        padding: 0.6rem 1rem;
    }
    
    .search-input {
        font-size: 1rem;
    }
    
    /* Site Grid */
    .site-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .site-card {
        padding: 1rem;
    }
    
    .site-icon {
        font-size: 2rem;
    }
    
    .site-name {
        font-size: 0.9rem;
    }
    
    /* FAB */
    .fab {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
        right: 1rem;
        bottom: 1rem;
    }
    
    /* Tabs */
    .tabs-container {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .tab-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        flex: 1 1 auto;
        min-width: 80px;
        text-align: center;
    }
    
    /* Detail Header */
    .detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .detail-header h2 {
        font-size: 1.25rem;
    }
    
    /* Category Section */
    .category-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .mini-upload-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Tables */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .pim-data-table,
    .measurement-form-table,
    .slide-table {
        font-size: 0.7rem;
    }
    
    .pim-data-table th,
    .pim-data-table td,
    .measurement-form-table th,
    .measurement-form-table td {
        padding: 0.4rem 0.5rem;
        white-space: nowrap;
    }
    
    /* Table Controls */
    .table-controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .table-controls button {
        width: 100%;
        justify-content: center;
    }
    
    /* Form */
    .form-section {
        padding: 1rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .save-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Picture Grid */
    .picture-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.5rem;
    }
    
    .thumbnail-img {
        height: 80px;
    }
    
    /* Modal */
    .modal-content {
        width: 90%;
        margin: 1rem;
        padding: 1.5rem;
    }
    
    /* Report Tab */
    .report-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .report-controls-left,
    .report-controls-right {
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .slide-nav {
        width: 100%;
        justify-content: center;
    }
    
    .report-btn {
        width: 100%;
        justify-content: center;
    }
    
    .slide {
        padding: 1rem;
        aspect-ratio: auto;
        min-height: 400px;
    }
    
    .slide-title {
        font-size: 1rem;
    }
    
    .slides-thumbnails {
        justify-content: center;
    }
    
    .slide-thumbnail {
        width: 80px;
    }
    
    /* Chart Overlay */
    .chart-content {
        width: 95%;
        padding: 1rem;
    }
    
    .chart-image {
        max-height: 60vh;
    }
}

@media screen and (max-width: 480px) {
    .container {
        padding: 0.75rem;
    }
    
    header h1 {
        font-size: 1.25rem;
    }
    
    .site-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .tab-btn {
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
        min-width: 60px;
    }
    
    .pim-data-table,
    .measurement-form-table {
        font-size: 0.65rem;
    }
    
    .slide {
        min-height: 300px;
    }
    
    .slide-table {
        font-size: 0.6rem;
    }
    
    .slide-table th,
    .slide-table td {
        padding: 0.2rem 0.3rem;
    }
}

/* Form textarea styles */
.form-field textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    background: var(--card-bg);
    color: var(--text-color);
    line-height: 1.5;
}

.form-field textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(80, 179, 215, 0.1);
}

.form-field textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

/* Title Cover Slide Styles */
.title-cover-slide {
    background: linear-gradient(135deg, #1a2942 0%, #2c3e50 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow: hidden;
}

.title-cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.title-cover-placeholder {
    text-align: center;
    color: #fff;
    padding: 3rem;
}

.title-cover-placeholder h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
}

/* Text Slide Styles (Summary, Build Issues) */
.text-slide {
    background: #fff;
    display: flex;
    flex-direction: column;
}

.text-slide .slide-content.text-content {
    flex: 1;
    padding: 1.5rem 2rem;
    overflow-y: auto;
}

.text-slide .slide-text {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-color);
}

/* Cover Slide Styles */
.cover-slide {
    background: #fff;
    padding: 0;
}

.cover-layout {
    display: grid;
    grid-template-columns: 55% 45%;
    height: 100%;
    min-height: 400px;
}

.cover-left {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.cover-metadata {
    margin-bottom: 2rem;
}

.cover-field {
    display: flex;
    margin-bottom: 0.6rem;
    font-size: 0.95rem;
}

.cover-label {
    font-weight: 600;
    min-width: 120px;
    color: var(--text-color);
}

.cover-value {
    font-weight: 600;
    color: var(--text-color);
}

.cover-schedule {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.cover-schedule-item {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-color);
}

.cover-right {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    padding: 1rem;
}

.cover-image {
    max-width: 100%;
    max-height: 350px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cover-no-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-align: center;
}

.cover-no-image i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.cover-no-image p {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.cover-no-image small {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Responsive cover slide */
@media (max-width: 768px) {
    .cover-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
    }
    
    .cover-right {
        order: -1;
        min-height: 200px;
    }
    
    .cover-image {
        max-height: 180px;
    }
}

/* Build Issue Pictures Slide */
.build-issue-pictures-slide {
    background: white;
}

.build-issue-images {
    display: grid;
    gap: 1rem;
    height: 100%;
    padding: 0.5rem;
}

.build-issue-images.single {
    grid-template-columns: 1fr;
    justify-items: center;
}

.build-issue-images.double {
    grid-template-columns: 1fr 1fr;
}

.build-issue-images.triple {
    grid-template-columns: 1fr 1fr 1fr;
}

.build-issue-images.quad {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

/* Chart Images Grid (for 2 charts side by side) */
.chart-images-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    height: 100%;
    padding: 0.5rem;
}

.chart-image-container {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a2942;
    border-radius: 8px;
    overflow: hidden;
    padding: 0.5rem;
}

.chart-preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.chart-branch-label {
    position: absolute;
    top: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(80, 179, 215, 0.9);
    color: white;
    padding: 0.2rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 5;
}

.chart-image-container {
    position: relative;
}

.chart-image-container.chart-na {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.chart-na-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6b7c93;
    gap: 0.5rem;
}

.chart-na-content i {
    font-size: 3rem;
    opacity: 0.5;
}

.chart-na-content span {
    font-size: 2rem;
    font-weight: 700;
}

.build-issue-image-container {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
    max-height: 300px;
}

.build-issue-image {
    max-width: 100%;
    max-height: 280px;
    object-fit: contain;
    border-radius: 4px;
}
