/* PromoComparison System - Main Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
    --primary: #4F46E5;
    --primary-light: #EEF2FF;
    --primary-hover: #4338CA;
    --sidebar-bg: #FFFFFF;
    --sidebar-width: 220px;
    --topbar-height: 60px;
    --bg: #F8F9FC;
    --card-bg: #FFFFFF;
    --border: #E5E7EB;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --green: #10B981;
    --orange: #F59E0B;
    --red: #EF4444;
    --blue: #3B82F6;
    --purple: #8B5CF6;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --radius: 10px;
    --radius-sm: 6px;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
}

/* ===== LAYOUT ===== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px;
    border-bottom: 1px solid var(--border);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.logo-text {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.logo-text span {
    color: var(--primary);
}

.sidebar-nav {
    padding: 12px 10px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: all 0.15s ease;
}

.nav-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.quality-card {
    background: var(--primary-light);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
}

.quality-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    color: white;
    font-size: 16px;
}

.quality-card h4 {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.quality-card p {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 28px 28px 40px;
    min-height: 100vh;
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header-left h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.page-header-left p {
    font-size: 13px;
    color: var(--text-secondary);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary);
    color: white;
    border: none;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease;
}

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

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: white;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-secondary:hover {
    background: var(--bg);
    color: var(--text-primary);
}

/* ===== STAT CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
}

.stat-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon-wrap.blue { background: #EFF6FF; color: #3B82F6; }
.stat-icon-wrap.green { background: #ECFDF5; color: #10B981; }
.stat-icon-wrap.purple { background: #F5F3FF; color: #8B5CF6; }
.stat-icon-wrap.orange { background: #FFFBEB; color: #F59E0B; }

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 2px;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== TWO-COLUMN LAYOUT ===== */
.content-row {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    margin-bottom: 24px;
}

/* ===== CARD ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

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

.card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-title svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
}

.view-all-link {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.view-all-link:hover { text-decoration: underline; }

.card-body {
    padding: 0;
}

/* ===== TABLE ===== */
.submissions-table {
    width: 100%;
    border-collapse: collapse;
}

.submissions-table th {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    background: #FAFAFA;
}

.submissions-table td {
    padding: 13px 20px;
    border-bottom: 1px solid #F3F4F6;
    vertical-align: middle;
}

.submissions-table tr:last-child td {
    border-bottom: none;
}

.submissions-table tr:hover td {
    background: #FAFBFF;
}

.submission-title-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.file-icon.blue { background: #EFF6FF; color: #3B82F6; }
.file-icon.purple { background: #F5F3FF; color: #8B5CF6; }
.file-icon.green { background: #ECFDF5; color: #10B981; }
.file-icon.orange { background: #FFFBEB; color: #F59E0B; }
.file-icon.red { background: #FEF2F2; color: #EF4444; }

.title-text {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
}

.type-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 500;
    background: var(--primary-light);
    color: var(--primary);
}

.date-text {
    font-size: 12.5px;
    color: var(--text-secondary);
}

/* Similarity bar */
.similarity-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.similarity-bar-track {
    width: 80px;
    height: 6px;
    background: #E5E7EB;
    border-radius: 10px;
    overflow: hidden;
}

.similarity-bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.4s ease;
}

.bar-red { background: #EF4444; }
.bar-orange { background: #F59E0B; }
.bar-yellow { background: #FBBF24; }
.bar-green { background: #10B981; }

.similarity-pct {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 34px;
}

/* Result badges */
.result-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-reused { background: #FEE2E2; color: #DC2626; }
.badge-modified { background: #FEF3C7; color: #D97706; }
.badge-unique { background: #D1FAE5; color: #059669; }
.badge-others { background: #F3F4F6; color: #6B7280; }

/* Action buttons */
.action-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-report {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-report:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.btn-dots {
    background: none;
    border: none;
    padding: 5px 6px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: background 0.15s ease;
}

.btn-dots:hover {
    background: var(--bg);
    color: var(--text-secondary);
}

/* ===== UPLOAD PANEL ===== */
.upload-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.upload-panel-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}

.upload-panel-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 18px;
    flex-shrink: 0;
}

.upload-panel-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.upload-panel-header p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.upload-panel-body {
    padding: 16px 18px;
}

.form-group {
    margin-bottom: 14px;
}

.form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.form-label .required {
    color: var(--red);
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    background: white;
    outline: none;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.15s ease;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

textarea.form-control {
    resize: vertical;
    min-height: 64px;
}

/* File input */
.file-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-choose-file {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.btn-choose-file:hover {
    background: var(--bg);
}

.file-name-display {
    font-size: 12px;
    color: var(--text-muted);
}

.file-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

input[type="file"] {
    display: none;
}

/* Analyze button */
.btn-analyze {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 11px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.15s ease;
    margin-top: 6px;
}

.btn-analyze:hover {
    background: var(--primary-hover);
}

.btn-cancel {
    width: 100%;
    background: white;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 10px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.15s ease;
}

.btn-cancel:hover {
    background: var(--bg);
}

/* How it works */
.how-it-works {
    border-top: 1px solid var(--border);
    padding: 14px 18px;
}

.how-title {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.how-item {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 11.5px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    line-height: 1.4;
}

.how-item svg {
    width: 13px;
    height: 13px;
    color: var(--green);
    flex-shrink: 0;
    margin-top: 1px;
}

/* ===== CONTENT OVERVIEW ===== */
.overview-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.donut-section {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
}

.donut-wrap {
    flex-shrink: 0;
}

.donut-legend {
    flex: 1;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 12.5px;
    color: var(--text-secondary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-dot.red { background: #EF4444; }
.legend-dot.orange { background: #F59E0B; }
.legend-dot.green { background: #10B981; }
.legend-dot.gray { background: #D1D5DB; }

.legend-label { flex: 1; font-weight: 500; }
.legend-value { font-weight: 600; color: var(--text-primary); }

/* Tip box */
.tip-box {
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    border-radius: var(--radius);
    padding: 16px 20px;
}

.tip-box-inner {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.tip-icon {
    color: #F59E0B;
    font-size: 20px;
    flex-shrink: 0;
}

.tip-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.tip-text {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ===== REPORT PAGE ===== */
.report-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
}

.report-summary-card {
    padding: 20px;
}

.result-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.result-hero.unique { background: #ECFDF5; border: 1px solid #A7F3D0; }
.result-hero.reused { background: #FEF2F2; border: 1px solid #FECACA; }
.result-hero.modified { background: #FFFBEB; border: 1px solid #FDE68A; }

.result-hero-icon {
    font-size: 36px;
}

.result-hero h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.result-hero p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 3px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.detail-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.empty-state h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 13px;
}

/* ===== MESSAGES ===== */
.messages-container {
    margin-bottom: 16px;
}

.alert {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 8px;
}

.alert-success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-error { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-info { background: var(--primary-light); color: #3730A3; border: 1px solid #C7D2FE; }

/* ===== ANALYTICS PAGE ===== */
.analytics-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

/* ===== MEDIA LIBRARY ===== */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    padding: 16px;
}

.media-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow 0.15s ease;
}

.media-item:hover {
    box-shadow: var(--shadow);
}

.media-preview {
    width: 100%;
    height: 100px;
    background: #F3F4F6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.media-info {
    padding: 8px 10px;
}

.media-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .content-row {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .main-content {
        margin-left: 0;
        padding: 16px;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Donut chart SVG */
.donut-svg {
    transform: rotate(-90deg);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }
