@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --success: #10b981;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --hover-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.08);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.logo svg {
    width: 2rem;
    height: 2rem;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s ease;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
}

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

main {
    max-width: 1200px;
    margin: 2.5rem auto;
    padding: 0 1.5rem;
    flex-grow: 1;
    width: 100%;
}

/* Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 2rem;
    align-items: start;
}

#upload-card,
#history-card,
#privacy-card {
    grid-column: 1 / -1; /* Spans both columns */
}

@media (max-width: 968px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Card Design */
.card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

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

.card-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title svg {
    color: var(--primary);
    width: 1.5rem;
    height: 1.5rem;
}

/* Dropzone Styling */
.dropzone-container {
    margin-bottom: 1.5rem;
}

.dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 0.75rem;
    padding: 3rem 2rem;
    text-align: center;
    background-color: var(--bg-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 250px;
}

.dropzone.dragover {
    border-color: var(--primary);
    background-color: var(--primary-light);
    transform: scale(1.01);
}

.dropzone-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: inline-block;
    transition: transform 0.3s ease;
}

.dropzone:hover .dropzone-icon,
.dropzone.dragover .dropzone-icon {
    transform: translateY(-5px);
}

.dropzone-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.dropzone-subtext {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: var(--primary);
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

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

.btn:active {
    transform: scale(0.98);
}

.btn-secondary {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: none;
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

/* File Upload Process UI */
.upload-status-card {
    display: none;
    margin-top: 1.5rem;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    background-color: var(--bg-primary);
}

.file-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.file-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    word-break: break-all;
    max-width: 70%;
}

.file-size {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.progress-wrapper {
    width: 100%;
    background-color: var(--border-color);
    height: 0.5rem;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary);
    width: 0%;
    transition: width 0.1s linear;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Processing Spinner */
.processing-indicator {
    display: none;
    text-align: center;
    padding: 2rem 0;
}

.spinner {
    width: 3rem;
    height: 3rem;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem auto;
}

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

.processing-text {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.processing-subtext {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Info and Guide styling */
.guide-section {
    margin-bottom: 1.5rem;
}

.guide-section:last-child {
    margin-bottom: 0;
}

.guide-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.guide-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.guide-list {
    margin-left: 1.25rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.guide-list li {
    margin-bottom: 0.375rem;
}

code {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    padding: 0.125rem 0.25rem;
    font-family: monospace;
    font-size: 0.85em;
    color: #e06c75;
}

pre {
    background-color: #0f172a;
    color: #f8fafc;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    font-size: 0.85rem;
    margin: 0.5rem 0 1rem 0;
}

pre code {
    background: transparent;
    border: none;
    color: inherit;
    padding: 0;
}

/* SEO Copy Section */
.seo-section {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 2.5rem;
    margin-top: 3rem;
    box-shadow: var(--card-shadow);
}

.seo-title {
    font-family: var(--font-heading);
    font-size: 1.65rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.seo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
}

@media (max-width: 768px) {
    .seo-grid {
        grid-template-columns: 1fr;
    }
}

.seo-heading {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.seo-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.seo-text:last-child {
    margin-bottom: 0;
}

/* Footer */
footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 3rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Alert popup for errors */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    display: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-error {
    background-color: #fef2f2;
    border: 1px solid #fee2e2;
    color: #991b1b;
}

.alert-success {
    background-color: #ecfdf5;
    border: 1px solid #d1fae5;
    color: #065f46;
}

/* History Section */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.history-item:hover {
    border-color: var(--border-hover);
    box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.02);
}

.history-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.history-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    word-break: break-all;
}

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

.history-actions {
    display: flex;
    gap: 1.25rem; /* Increased spacing between View and Delete buttons */
    align-items: center;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 0.375rem;
    box-shadow: none;
}

.btn-danger {
    background-color: #ef4444;
    color: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.1);
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-danger:active {
    transform: scale(0.98);
}

/* Report Preview Section */
.preview-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .preview-charts {
        grid-template-columns: 1fr;
    }
}

.preview-chart-item {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preview-chart-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    align-self: flex-start;
}

.preview-img {
    width: 100%;
    height: auto;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
    background-color: #ffffff;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.02);
}

/* Responsive Table Wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 0.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

/* Webalizer Summary Table Styling */
.webalizer-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: center;
    background-color: #ffffff;
}

.webalizer-table th, 
.webalizer-table td {
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border-color);
    white-space: nowrap;
}

.webalizer-table thead th {
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--text-primary);
}

.webalizer-table thead tr:first-child th {
    background-color: var(--bg-primary);
    font-size: 0.9rem;
    padding: 0.5rem;
}

.webalizer-table thead tr:first-child th.header-group {
    background-color: #f1f5f9;
}

/* Webalizer Muted Color Columns */
.webalizer-table th.th-hits {
    background-color: #d1fae5;
    color: #065f46;
}

.webalizer-table th.th-files {
    background-color: #dbeafe;
    color: #1e40af;
}

.webalizer-table th.th-pages {
    background-color: #e0f2fe;
    color: #0369a1;
}

.webalizer-table th.th-visits {
    background-color: #fef9c3;
    color: #854d0e;
}

.webalizer-table th.th-sites {
    background-color: #ffedd5;
    color: #9a3412;
}

.webalizer-table th.th-kb {
    background-color: #fee2e2;
    color: #991b1b;
}

.webalizer-table tbody td {
    color: var(--text-secondary);
}

.webalizer-table tbody td.num {
    font-family: monospace;
    font-size: 0.9rem;
    font-weight: 500;
}

.webalizer-table tbody tr:hover {
    background-color: var(--primary-light);
}

.webalizer-table tbody tr.totals-row {
    font-weight: 700;
    background-color: #f8fafc;
}

.webalizer-table tbody tr.totals-row td {
    color: var(--text-primary);
    font-weight: 700;
}

.webalizer-table a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.webalizer-table a:hover {
    text-decoration: underline;
}

