:root {
    --bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card: rgba(255, 255, 255, 0.95);
    --text: #2d3748;
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --success: #48bb78;
    --error: #f56565;
    --warning: #ed8936;
    --info: #4299e1;
    --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    padding-top: 100px;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    z-index: -1;
}

.container {
    width: 100%;
    max-width: 1200px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
    margin: 0 auto;
    justify-content: center;
    place-content: center;
    flex: 1;
    margin-top: 2rem;
}

.history-container {
    max-width: 1400px;
    grid-template-columns: 1fr;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: var(--transition);
    width: 100%;
    max-width: 580px;
    margin: 0 auto;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.header p {
    color: #718096;
    font-size: 1.1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #f7fafc, #edf2f7);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #e2e8f0;
    transition: var(--transition);
}

.stat-card:hover {
    background: linear-gradient(135deg, #edf2f7, #e2e8f0);
    transform: translateY(-2px);
}

.stat-card i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.stat-card h3 {
    font-size: 1.5rem;
    color: var(--text);
    margin-bottom: 5px;
}

.stat-card p {
    color: #718096;
    font-size: 0.9rem;
}

.form-section h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section h3 i {
    color: var(--primary);
}

.field {
    margin-bottom: 20px;
}

label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

label i {
    color: var(--primary);
    width: 16px;
}

input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    transition: var(--transition);
    background: #f7fafc;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}

.file-input-wrapper input[type=file] {
    position: absolute;
    left: -9999px;
}

.file-input-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f7fafc;
    border: 2px dashed #cbd5e0;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    color: #718096;
}

.file-input-button:hover {
    border-color: var(--primary);
    background: #edf2f7;
}

button {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.info-box {
    background: linear-gradient(135deg, #ebf8ff, #bee3f8);
    border: 1px solid #90cdf4;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.info-box i {
    color: var(--info);
    font-size: 1.2rem;
    margin-top: 2px;
}

.info-box p {
    color: #2b6cb0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.overlay.show {
    display: flex;
}

.loader {
    background: white;
    border-radius: var(--radius);
    padding: 40px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow);
    position: relative;
}

.loader-header {
    text-align: center;
    margin-bottom: 30px;
}

.loader-header h3 {
    font-size: 1.5rem;
    color: var(--text);
    margin-bottom: 10px;
}

.loader-header p {
    color: #718096;
    font-size: 0.9rem;
}

.progress-container {
    margin-bottom: 30px;
}

.progress-bar {
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 6px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    text-align: center;
    margin-top: 10px;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
}

.status {
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.status.loading {
    background: linear-gradient(135deg, #ebf8ff, #bee3f8);
    border: 1px solid #90cdf4;
    color: #2b6cb0;
}

.status.success {
    background: linear-gradient(135deg, #f0fff4, #c6f6d5);
    border: 1px solid #9ae6b4;
    color: #22543d;
}

.status.error {
    background: linear-gradient(135deg, #fed7d7, #feb2b2);
    border: 1px solid #fc8181;
    color: #742a2a;
}

.status-icon {
    font-size: 1.5rem;
}

.status-content {
    flex: 1;
}

.status-content h4 {
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.status-content p {
    font-size: 0.9rem;
    opacity: 0.8;
}

.close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    color: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.2);
}

.log-container {
    background: #f7fafc;
    border-radius: 10px;
    padding: 20px;
    max-height: 200px;
    overflow-y: auto;
}

.log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.log-header h5 {
    font-size: 1rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.log-content {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #4a5568;
    white-space: pre-wrap;
}

.log-entry {
    margin-bottom: 8px;
    padding: 4px 0;
    border-left: 3px solid transparent;
    padding-left: 12px;
}

.log-entry.info {
    border-left-color: var(--info);
}

.log-entry.success {
    border-left-color: var(--success);
}

.log-entry.error {
    border-left-color: var(--error);
}

.log-entry.warning {
    border-left-color: var(--warning);
}

.features {
    margin-top: 30px;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 10px;
    transition: var(--transition);
}

.feature-item:hover {
    background: #edf2f7;
    transform: translateX(5px);
}

.feature-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.feature-content h4 {
    font-size: 1.1rem;
    margin-bottom: 5px;
    color: var(--text);
}

.feature-content p {
    color: #718096;
    font-size: 0.9rem;
    line-height: 1.5;
}

.nav-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 100;
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.nav-brand:hover {
    color: var(--primary-dark);
    transform: scale(1.05);
}

.nav-brand i {
    font-size: 1.5rem;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    color: #4a5568;
    text-decoration: none;
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
}

.nav-links a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    opacity: 0;
    transition: var(--transition);
    z-index: -1;
    border-radius: 10px;
}

.nav-links a:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.nav-links a:hover::before {
    opacity: 1;
}

.nav-links a.active {
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.nav-links a.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.nav-links i {
    font-size: 1rem;
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-box {
    background: linear-gradient(135deg, #f7fafc, #edf2f7);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: var(--transition);
}

.stat-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-box.success {
    background: linear-gradient(135deg, #f0fff4, #c6f6d5);
    border-color: #9ae6b4;
}

.stat-box.error {
    background: linear-gradient(135deg, #fed7d7, #feb2b2);
    border-color: #fc8181;
}

.stat-box.primary {
    background: linear-gradient(135deg, #ebf8ff, #bee3f8);
    border-color: #90cdf4;
}

.stat-box.warning {
    background: linear-gradient(135deg, #fef5e7, #fdebd0);
    border-color: #f6e05e;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-box.success .stat-icon { color: #48bb78; }
.stat-box.error .stat-icon { color: #f56565; }
.stat-box.primary .stat-icon { color: #4299e1; }
.stat-box.warning .stat-icon { color: #d69e2e; }

.stat-info h3 {
    font-size: 1.8rem;
    margin: 0;
    color: var(--text);
}

.stat-info p {
    margin: 0;
    color: #718096;
    font-size: 0.9rem;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 250px;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 12px 20px 12px 45px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    transition: var(--transition);
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #718096;
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.filter-select:hover, .filter-select:focus {
    border-color: var(--primary);
}

.btn-action {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    text-decoration: none;
    font-size: 0.9rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #edf2f7;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-danger {
    background: linear-gradient(135deg, #f56565, #c53030);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.table-wrapper {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.history-table th {
    background: #f7fafc;
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.history-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.history-table th.sortable:hover {
    background: #edf2f7;
}

.history-table th i {
    margin-left: 5px;
    font-size: 0.8rem;
    color: #a0aec0;
}

.history-table td {
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

.history-table tr:hover {
    background: #f7fafc;
}

.history-table tr:last-child td {
    border-bottom: none;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.success {
    background: #c6f6d5;
    color: #22543d;
}

.status-badge.error {
    background: #fed7d7;
    color: #742a2a;
}

.status-badge i {
    font-size: 0.7rem;
}

.cell-db {
    font-weight: 600;
    color: var(--primary-dark);
}

.cell-file {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #4a5568;
}

.cell-file i {
    color: #718096;
}

.cell-message {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #718096;
    font-size: 0.9rem;
}

.cell-message:hover {
    white-space: normal;
    word-break: break-word;
}

.cell-actions {
    display: flex;
    gap: 5px;
    flex-wrap: nowrap;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #f7fafc;
    border-radius: 12px;
}

.empty-state i {
    font-size: 4rem;
    color: #cbd5e0;
    margin-bottom: 20px;
}

.empty-state h3 {
    color: #4a5568;
    margin-bottom: 10px;
}

.empty-state p {
    color: #718096;
    margin-bottom: 20px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.pagination button {
    width: 40px;
    height: 40px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: #4a5568;
    margin: 0;
}

.pagination button:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: #f7fafc;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination-info {
    color: #718096;
    font-size: 0.9rem;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.detail-row {
    display: flex;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #edf2f7;
}

.detail-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.detail-label {
    width: 120px;
    font-weight: 600;
    color: #4a5568;
    flex-shrink: 0;
}

.detail-value {
    flex: 1;
    color: #2d3748;
}

.detail-value code {
    background: #f7fafc;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.9rem;
}

.timestamp {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.time-main {
    font-weight: 600;
    color: var(--text);
}

.time-ago {
    font-size: 0.85rem;
    color: #718096;
}

@media (max-width: 968px) {
    .history-table th:nth-child(3),
    .history-table td:nth-child(3),
    .history-table th:nth-child(6),
    .history-table td:nth-child(6) {
        display: none;
    }
}

@media (max-width: 768px) {
    .nav-container {
        padding: 0 1rem;
    }
    
    .nav-brand span {
        display: none;
    }
    
    .nav-links {
        gap: 0.25rem;
    }
    
    .nav-links a {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    
    .nav-links a span {
        display: none;
    }
    
    .nav-links i {
        font-size: 1.2rem;
    }
    
    body {
        padding-top: 80px;
    }
    
    .container {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 1rem;
    }
    
    .card {
        padding: 25px;
        max-width: 100%;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .history-table th:nth-child(4),
    .history-table td:nth-child(4) {
        display: none;
    }
    
    .cell-actions {
        flex-direction: column;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        max-width: 100%;
    }
    
    .stats-overview {
        grid-template-columns: repeat(2, 1fr);
    }
}
