/* ============================================================================
   File Upload & Database Management System - Dark Theme Stylesheet
   ============================================================================ */

/* ============================================================================
   Global Styles & Reset
   ============================================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', 'Courier', monospace;
    background: #0a0e27;
    color: #00ff00;
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: #00ff00;
    text-decoration: none;
}

a:hover {
    color: #00ff66;
    text-decoration: underline;
}

/* ============================================================================
   Container & Layout
   ============================================================================ */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ============================================================================
   Header & Navigation
   ============================================================================ */

.header {
    background: #1a1a2e;
    border: 2px solid #00ff00;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    color: #ff0000;
    letter-spacing: 2px;
    text-shadow: 0 0 10px #ff0000;
}

.nav {
    display: flex;
    gap: 20px;
}

.nav-link {
    padding: 10px 20px;
    border: 1px solid #00ff00;
    background: transparent;
    color: #00ff00;
    text-decoration: none;
    transition: all 0.3s;
}

.nav-link:hover,
.nav-link.active {
    background: #00ff00;
    color: #0a0e27;
    text-shadow: none;
}

/* ============================================================================
   Stats Bar
   ============================================================================ */

.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-item {
    background: #1a1a2e;
    border: 1px solid #00ff00;
    padding: 15px;
    text-align: center;
}

.stat-label {
    color: #00ff66;
    font-size: 12px;
    margin-bottom: 5px;
}

.stat-value {
    color: #ff0000;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 0 5px #ff0000;
}

.stat-value.small {
    font-size: 14px;
}

/* ============================================================================
   Search Container
   ============================================================================ */

.search-container {
    background: #1a1a2e;
    border: 1px solid #00ff00;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

.search-input {
    flex: 1;
    background: #0a0e27;
    border: 1px solid #00ff00;
    color: #00ff00;
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    box-shadow: 0 0 10px #00ff00;
}

/* ============================================================================
   Buttons
   ============================================================================ */

.btn {
    padding: 10px 20px;
    border: 1px solid #00ff00;
    background: transparent;
    color: #00ff00;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    background: #00ff00;
    color: #0a0e27;
    text-decoration: none;
}

.btn-primary {
    background: #00ff00;
    color: #0a0e27;
}

.btn-primary:hover {
    background: #00ff66;
}

.btn-secondary {
    border-color: #666;
    color: #666;
}

.btn-secondary:hover {
    background: #666;
    color: #0a0e27;
}

.btn-danger {
    border-color: #ff0000;
    color: #ff0000;
}

.btn-danger:hover {
    background: #ff0000;
    color: #0a0e27;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
    margin-bottom: 10px;
}

/* ============================================================================
   Table Styles
   ============================================================================ */

.table-container {
    background: #1a1a2e;
    border: 1px solid #00ff00;
    padding: 20px;
    margin-bottom: 20px;
    overflow-x: auto;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #00ff00;
}

.table-header h2 {
    color: #ff0000;
}

.auto-refresh {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #00ff66;
    font-size: 12px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    background: #00ff00;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    background: #0a0e27;
    color: #ff0000;
    border: 1px solid #00ff00;
    padding: 10px;
    text-align: left;
    font-weight: bold;
}

.data-table td {
    border: 1px solid #00ff00;
    padding: 10px;
    color: #00ff00;
}

.data-table tr:hover {
    background: rgba(0, 255, 0, 0.1);
}

.highlight {
    color: #00ff66;
    font-weight: bold;
}

.filename {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: #666;
}

.no-data p {
    font-size: 18px;
    margin-bottom: 10px;
}

.hint {
    font-size: 12px;
    color: #444;
}

/* ============================================================================
   Database Layout (Sidebar + Content)
   ============================================================================ */

.db-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.db-sidebar {
    background: #1a1a2e;
    border: 1px solid #00ff00;
    padding: 20px;
    height: fit-content;
}

.sidebar-section {
    margin-bottom: 30px;
}

.sidebar-title {
    color: #ff0000;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #00ff00;
}

.table-list {
    list-style: none;
}

.table-item {
    margin-bottom: 10px;
}

.table-item a {
    display: block;
    padding: 10px;
    background: #0a0e27;
    border: 1px solid #00ff00;
    text-decoration: none;
    transition: all 0.3s;
}

.table-item a:hover {
    background: #00ff00;
    color: #0a0e27;
    text-decoration: none;
}

.table-name {
    display: block;
    font-weight: bold;
}

.table-count {
    display: block;
    font-size: 11px;
    color: #666;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.db-content {
    background: #1a1a2e;
    border: 1px solid #00ff00;
    padding: 20px;
}

/* ============================================================================
   Database Overview
   ============================================================================ */

.db-overview h2 {
    color: #ff0000;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #00ff00;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.info-card {
    background: #0a0e27;
    border: 1px solid #00ff00;
    padding: 15px;
}

.info-label {
    color: #00ff66;
    font-size: 12px;
    margin-bottom: 5px;
}

.info-value {
    color: #00ff00;
    font-size: 16px;
}

.tables-overview h3 {
    color: #ff0000;
    margin-bottom: 15px;
}

.table-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.table-card {
    background: #0a0e27;
    border: 1px solid #00ff00;
    padding: 15px;
    text-align: center;
}

.table-card-name {
    color: #00ff00;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
}

.table-card-rows {
    color: #666;
    font-size: 12px;
    margin-bottom: 15px;
}

/* ============================================================================
   Breadcrumb
   ============================================================================ */

.breadcrumb {
    background: #1a1a2e;
    border: 1px solid #00ff00;
    padding: 10px 15px;
    margin-bottom: 20px;
    font-size: 14px;
}

.breadcrumb a {
    color: #00ff66;
}

.breadcrumb span {
    color: #00ff00;
}

/* ============================================================================
   Table Info Bar
   ============================================================================ */

.table-info-bar {
    background: #1a1a2e;
    border: 1px solid #00ff00;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-info {
    display: flex;
    gap: 10px;
    align-items: center;
}

.info-label {
    color: #00ff66;
}

.info-value {
    color: #00ff00;
    font-weight: bold;
}

.table-actions {
    display: flex;
    gap: 10px;
}

/* ============================================================================
   Schema Display
   ============================================================================ */

.schema-container {
    background: #1a1a2e;
    border: 1px solid #00ff00;
    padding: 20px;
    margin-bottom: 20px;
}

.schema-container h3 {
    color: #ff0000;
    margin-bottom: 15px;
}

.schema-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px;
}

.schema-item {
    background: #0a0e27;
    border: 1px solid #00ff00;
    padding: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.col-name {
    color: #00ff00;
    font-weight: bold;
}

.col-type {
    color: #666;
    font-size: 12px;
}

.col-badge {
    font-size: 10px;
    padding: 2px 6px;
    border: 1px solid;
    border-radius: 3px;
}

.col-badge.pk {
    border-color: #ff0000;
    color: #ff0000;
}

.col-badge.notnull {
    border-color: #00ff66;
    color: #00ff66;
}

/* ============================================================================
   Pagination
   ============================================================================ */

.pagination {
    background: #1a1a2e;
    border: 1px solid #00ff00;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 10px;
    align-items: center;
}

.page-info {
    color: #00ff00;
    padding: 0 20px;
}

/* ============================================================================
   Query Interface
   ============================================================================ */

.query-container {
    background: #1a1a2e;
    border: 1px solid #00ff00;
    padding: 20px;
    margin-bottom: 20px;
}

.query-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.query-header h3 {
    color: #ff0000;
}

.query-actions {
    display: flex;
    gap: 10px;
}

.query-editor {
    width: 100%;
    background: #0a0e27;
    border: 1px solid #00ff00;
    color: #00ff00;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: vertical;
    min-height: 150px;
}

.query-editor:focus {
    outline: none;
    box-shadow: 0 0 10px #00ff00;
}

.query-info {
    margin-top: 10px;
    color: #00ff66;
    font-size: 12px;
}

.examples-section {
    margin-top: 30px;
}

.examples-section h3 {
    color: #ff0000;
    margin-bottom: 15px;
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.example-card {
    background: #0a0e27;
    border: 1px solid #00ff00;
    padding: 15px;
}

.example-title {
    color: #00ff66;
    font-weight: bold;
    margin-bottom: 10px;
}

.example-query {
    background: #000;
    border: 1px solid #00ff00;
    padding: 10px;
    font-size: 11px;
    color: #00ff00;
    overflow-x: auto;
    margin-bottom: 10px;
}

/* ============================================================================
   Error & Results Display
   ============================================================================ */

.error-box {
    background: #1a1a2e;
    border: 2px solid #ff0000;
    padding: 20px;
    margin-bottom: 20px;
}

.error-header {
    color: #ff0000;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
}

.error-message {
    color: #ff6666;
    font-size: 14px;
}

.results-container {
    background: #1a1a2e;
    border: 1px solid #00ff00;
    padding: 20px;
    margin-bottom: 20px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #00ff00;
}

.results-header h3 {
    color: #ff0000;
}

.results-info {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* ============================================================================
   Edit Form
   ============================================================================ */

.edit-container {
    background: #1a1a2e;
    border: 1px solid #00ff00;
    padding: 20px;
    margin-bottom: 20px;
}

.edit-header {
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #00ff00;
}

.edit-header h2 {
    color: #ff0000;
    margin-bottom: 10px;
}

.edit-info {
    color: #00ff66;
    font-size: 14px;
}

.edit-form {
    max-width: 800px;
}

.form-group {
    margin-bottom: 25px;
}

.form-label {
    display: block;
    color: #00ff00;
    margin-bottom: 8px;
    font-weight: bold;
}

.form-type {
    color: #666;
    font-size: 12px;
    font-weight: normal;
    margin-left: 10px;
}

.form-input,
.form-textarea {
    width: 100%;
    background: #0a0e27;
    border: 1px solid #00ff00;
    color: #00ff00;
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    box-shadow: 0 0 10px #00ff00;
}

.form-input:read-only {
    background: #1a1a2e;
    color: #666;
}

.form-hint {
    display: block;
    color: #666;
    font-size: 11px;
    margin-top: 5px;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #00ff00;
}

/* ============================================================================
   Statistics Page
   ============================================================================ */

.stats-section {
    background: #1a1a2e;
    border: 1px solid #00ff00;
    padding: 20px;
    margin-bottom: 20px;
}

.stats-section h2 {
    color: #ff0000;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #00ff00;
}

.stats-section h3 {
    color: #ff0000;
    margin: 30px 0 15px 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: #0a0e27;
    border: 1px solid #00ff00;
    padding: 20px;
    text-align: center;
}

.stat-card-label {
    color: #00ff66;
    font-size: 12px;
    margin-bottom: 10px;
}

.stat-card-value {
    color: #ff0000;
    font-size: 32px;
    font-weight: bold;
    text-shadow: 0 0 10px #ff0000;
}

/* ============================================================================
   Footer
   ============================================================================ */

.footer {
    background: #1a1a2e;
    border: 1px solid #00ff00;
    padding: 15px;
    text-align: center;
    color: #666;
    font-size: 12px;
}

/* ============================================================================
   Sources Overview & Cards
   ============================================================================ */

.sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.source-card {
    background: #1a1a2e;
    border: 2px solid #00ff00;
    padding: 20px;
    transition: all 0.3s;
}

.source-card:hover {
    border-color: #00ff66;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
}

.source-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #00ff00;
}

.source-name {
    color: #00ff00;
    font-size: 20px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.new-badge {
    background: #ff0000;
    color: #ffffff;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: bold;
    border-radius: 3px;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; box-shadow: 0 0 5px #ff0000; }
    50% { opacity: 0.8; box-shadow: 0 0 15px #ff0000; }
}

.source-status {
    background: #00ff00;
    color: #0a0e27;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: bold;
}

.source-info {
    margin-bottom: 20px;
}

.source-info-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 255, 0, 0.2);
}

.source-timeline {
    margin-bottom: 20px;
    padding: 15px;
    background: #0a0e27;
    border: 1px solid #00ff00;
}

.timeline-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
}

.timeline-label {
    color: #00ff66;
    font-size: 12px;
}

.timeline-value {
    color: #00ff00;
    font-size: 12px;
}

.source-actions {
    display: flex;
    gap: 10px;
}

.source-actions .btn {
    flex: 1;
    text-align: center;
}

/* Source Detail Timeline */
.source-timeline-section {
    background: #1a1a2e;
    border: 1px solid #00ff00;
    padding: 20px;
    margin-bottom: 20px;
}

.source-timeline-section h3 {
    color: #ff0000;
    margin-bottom: 15px;
}

.timeline-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.timeline-card {
    background: #0a0e27;
    border: 1px solid #00ff00;
    padding: 15px;
    text-align: center;
}

.timeline-card .timeline-label {
    color: #00ff66;
    font-size: 12px;
    display: block;
    margin-bottom: 8px;
}

.timeline-card .timeline-value {
    color: #00ff00;
    font-size: 16px;
    font-weight: bold;
}

.daily-uploads {
    margin-top: 20px;
}

.daily-uploads h4 {
    color: #ff0000;
    margin-bottom: 10px;
}

.daily-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.daily-item {
    background: #0a0e27;
    border: 1px solid #00ff00;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.day-date {
    color: #00ff66;
    font-size: 12px;
}

.day-count {
    color: #00ff00;
    font-size: 14px;
    font-weight: bold;
    margin-top: 5px;
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

@media (max-width: 1024px) {
    .db-layout {
        grid-template-columns: 1fr;
    }

    .db-sidebar {
        order: 2;
    }

    .db-content {
        order: 1;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
    }

    .nav {
        flex-direction: column;
        width: 100%;
    }

    .nav-link {
        text-align: center;
    }

    .stats-bar {
        grid-template-columns: 1fr;
    }

    .search-container {
        flex-direction: column;
    }

    .table-info-bar {
        flex-direction: column;
        gap: 15px;
    }

    .form-actions {
        flex-direction: column;
    }
}
