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

:root {
    --primary: #1a365d;
    --primary-light: #2c5282;
    --secondary: #2d3748;
    --accent: #38a169;
    --accent-hover: #2f855a;
    --danger: #e53e3e;
    --danger-hover: #c53030;
    --warning: #d69e2e;
    --bg-light: #f7fafc;
    --bg-white: #ffffff;
    --border: #e2e8f0;
    --text-dark: #1a202c;
    --text-muted: #718096;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Dark Mode */
[data-theme="dark"] {
    --primary: #90cdf4;
    --primary-light: #63b3ed;
    --secondary: #a0aec0;
    --accent: #68d391;
    --accent-hover: #48bb78;
    --danger: #fc8181;
    --danger-hover: #f56565;
    --warning: #f6e05e;
    --bg-light: #1a202c;
    --bg-white: #2d3748;
    --border: #4a5568;
    --text-dark: #f7fafc;
    --text-muted: #a0aec0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] body {
    background-color: #171923;
}

[data-theme="dark"] header {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
}

[data-theme="dark"] .disk-badge {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

[data-theme="dark"] .stat-icon {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

[data-theme="dark"] .bar-fill {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
}

[data-theme="dark"] .bar-fill.accent {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

[data-theme="dark"] .bar-fill.warning {
    background: linear-gradient(135deg, #ecc94b 0%, #d69e2e 100%);
}

[data-theme="dark"] .checkbox-item.selected {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

[data-theme="dark"] tr:hover {
    background-color: #3d4a5c;
}

[data-theme="dark"] .recent-item:hover {
    background-color: #3d4a5c;
}

[data-theme="dark"] .btn-outline {
    border-color: #a0aec0;
    color: #a0aec0;
}

[data-theme="dark"] .btn-outline:hover {
    background-color: #a0aec0;
    color: #1a202c;
}

[data-theme="dark"] .btn-secondary {
    background-color: #4a5568;
}

[data-theme="dark"] .btn-secondary:hover {
    background-color: #718096;
}

[data-theme="dark"] .modal-overlay {
    background-color: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background-color: #1a202c;
    color: #f7fafc;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: #718096;
}

/* Theme Toggle Button */
.theme-toggle {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    transform: rotate(15deg);
}

[data-theme="dark"] .theme-toggle {
    border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .theme-toggle:hover {
    border-color: rgba(255, 255, 255, 0.4);
}

.theme-icon-light,
.theme-icon-dark {
    display: none;
}

:root .theme-icon-light {
    display: inline;
}

[data-theme="dark"] .theme-icon-light {
    display: none;
}

[data-theme="dark"] .theme-icon-dark {
    display: inline;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 30px 0;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

header h1 .icon {
    font-size: 2rem;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background-color: #4a5568;
}

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

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

.btn-outline {
    background-color: transparent;
    border: 2px solid white;
    color: white;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Search Section */
.search-section {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.search-section h2 {
    margin-bottom: 20px;
    color: var(--primary);
    font-size: 1.3rem;
}

.search-form {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 15px;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-light);
}

/* Results Section */
.results-section {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.results-header h2 {
    color: var(--primary);
    font-size: 1.3rem;
}

.results-count {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
}

/* Table */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background-color: var(--bg-light);
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover {
    background-color: #f0f9ff;
}

.disk-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin: 2px 4px 2px 0;
}

.disk-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* Checkbox group for multiple disk selection */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--bg-light);
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-white);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.checkbox-item:hover {
    border-color: var(--primary-light);
}

.checkbox-item.selected {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-item label {
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
}

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

.year-badge {
    display: inline-block;
    background-color: var(--accent);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.actions-cell {
    display: flex;
    gap: 8px;
}

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

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal.modal-lg {
    max-width: 650px;
}

.modal.modal-xl {
    max-width: 900px;
}

.modal h2 {
    margin-bottom: 25px;
    color: var(--primary);
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 10px;
}

/* Form rows for side-by-side fields */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-row .flex-2 {
    grid-column: span 1;
}

.form-row .flex-1 {
    grid-column: span 1;
}

.form-row .upload-actions {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

/* Profile Modal Styles */
.profile-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.profile-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.profile-title h2 {
    margin: 0;
    color: var(--primary);
}

.profile-actions {
    display: flex;
    gap: 8px;
}

.profile-content {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.profile-section {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 20px;
}

.profile-section h3 {
    margin: 0 0 15px 0;
    color: var(--primary);
    font-size: 1.1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-header h3 {
    margin: 0;
}

.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-field.full-width {
    grid-column: span 2;
}

.profile-field label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.profile-field span {
    font-size: 1rem;
    color: var(--text-dark);
}

/* Upload Form */
.upload-form {
    background: var(--bg-white);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border: 2px dashed var(--border);
}

.upload-form input[type="file"] {
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: 8px;
    width: 100%;
    cursor: pointer;
}

/* Documents List */
.documents-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.document-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-white);
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.document-item:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow);
}

.document-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.document-icon {
    font-size: 1.8rem;
    width: 40px;
    text-align: center;
}

.document-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.document-name {
    font-weight: 600;
    color: var(--text-dark);
}

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

.document-description {
    font-size: 0.9rem;
    color: var(--secondary);
    margin-left: auto;
    margin-right: 20px;
    max-width: 200px;
    text-align: right;
}

.document-actions {
    display: flex;
    gap: 8px;
}

.doc-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--secondary);
    color: white;
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.empty-state.small {
    padding: 30px 20px;
}

.empty-state.small .icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.empty-state.small p {
    font-size: 0.95rem;
}

/* Clickable customer name */
.customer-link {
    color: var(--primary);
    cursor: pointer;
    text-decoration: none;
}

.customer-link:hover {
    text-decoration: underline;
}

/* Document Preview Modal */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.preview-header h2 {
    margin: 0;
    color: var(--primary);
    font-size: 1.2rem;
    word-break: break-word;
}

.preview-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.preview-info {
    margin-bottom: 15px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.preview-content {
    background: var(--bg-light);
    border-radius: 8px;
    min-height: 300px;
    max-height: 60vh;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-content img {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
}

.preview-content iframe {
    width: 100%;
    height: 60vh;
    border: none;
    border-radius: 8px;
}

.preview-content .preview-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.preview-content .preview-placeholder .icon {
    font-size: 4rem;
    margin-bottom: 15px;
    display: block;
}

.preview-content .preview-placeholder p {
    margin-bottom: 20px;
}

.preview-content .text-preview {
    width: 100%;
    padding: 20px;
    font-family: monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-word;
    text-align: left;
    align-self: flex-start;
}

/* View button styling */
.btn-view {
    background-color: var(--primary-light);
    color: white;
}

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

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 30px;
    background: var(--bg-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.tab {
    flex: 1;
    padding: 16px 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
}

.tab:hover {
    background-color: var(--bg-light);
    color: var(--primary);
}

.tab.active {
    background-color: var(--bg-light);
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.empty-state p {
    font-size: 1.1rem;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    animation: slideIn 0.3s ease;
}

.notification.success {
    background-color: var(--accent);
}

.notification.error {
    background-color: var(--danger);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Dashboard Styles */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 12px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

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

.stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.dashboard-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.dashboard-card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.dashboard-card h3 {
    margin: 0 0 20px 0;
    color: var(--primary);
    font-size: 1.1rem;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.chart-container {
    min-height: 200px;
}

/* Bar Chart Styles */
.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bar-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bar-label {
    min-width: 100px;
    font-size: 0.9rem;
    color: var(--text-dark);
    font-weight: 500;
    text-align: right;
}

.bar-wrapper {
    flex: 1;
    height: 28px;
    background: var(--bg-light);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 6px;
    transition: width 0.5s ease;
    min-width: 2px;
}

.bar-fill.accent {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
}

.bar-fill.warning {
    background: linear-gradient(135deg, var(--warning) 0%, #b7791f 100%);
}

.bar-value {
    min-width: 50px;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* Recent List Styles */
.recent-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recent-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-light);
    border-radius: 8px;
    transition: background 0.2s ease;
}

.recent-item:hover {
    background: #e2e8f0;
}

.recent-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.recent-item-name {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
}

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

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

.recent-item-icon {
    font-size: 1.5rem;
    margin-right: 12px;
}

.recent-item-left {
    display: flex;
    align-items: center;
}

/* Empty chart state */
.chart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    color: var(--text-muted);
    text-align: center;
}

.chart-empty .icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Responsive */
@media (max-width: 900px) {
    .search-form {
        grid-template-columns: 1fr 1fr;
    }

    header .container {
        flex-direction: column;
        text-align: center;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .search-form {
        grid-template-columns: 1fr;
    }

    .tabs {
        flex-direction: column;
    }

    .tab {
        border-bottom: none;
        border-left: 3px solid transparent;
    }

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

    .actions-cell {
        flex-direction: column;
    }

    th, td {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-icon {
        font-size: 2rem;
        width: 50px;
        height: 50px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .bar-label {
        min-width: 70px;
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) { .form-row { grid-template-columns: 1fr; } .profile-grid { grid-template-columns: 1fr; } .profile-field.full-width { grid-column: span 1; } .document-item { flex-direction: column; align-items: flex-start; gap: 10px; } .document-description { margin-left: 0; margin-right: 0; text-align: left; max-width: none; } .document-actions { width: 100%; justify-content: flex-end; } }
