:root {
    --primary-color: #4a90e2;
    --secondary-color: #5cb85c;
    --danger-color: #d9534f;
    --warning-color: #f0ad4e;
    --background: #f5f7fa;
    --surface: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border: #e1e8ed;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.15);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

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

/* Header */
header {
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 1.5rem 0;
    margin-bottom: 2rem;
}

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

h1 {
    color: var(--text-primary);
    font-size: 1.8rem;
    font-weight: 600;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease;
}

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

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

.card-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

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

.btn-primary:hover {
    background-color: #357abd;
}

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

.btn-success:hover {
    background-color: #4cae4c;
}

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

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

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

.btn-secondary:hover {
    background-color: #6c7a7b;
}

.btn-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Login Form */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 3rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 420px;
}

.login-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.3s ease;
    background: var(--surface);
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Log Viewer */
.log-selector {
    margin-bottom: 1.5rem;
}

.log-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.log-item {
    background: var(--background);
    padding: 1rem;
    border-radius: 8px;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-primary);
    display: block;
}

.log-item:hover {
    border-color: var(--primary-color);
    background: var(--surface);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.log-item-name {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.log-item-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Log Content */
.log-viewer {
    background: #1e1e1e;
    border-radius: 8px;
    padding: 1.5rem;
    overflow-x: auto;
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    max-height: 600px;
    overflow-y: auto;
}

.log-viewer pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #d4d4d4;
}

.log-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #d4edda;
    color: #155724;
    border-radius: 8px;
    font-weight: 500;
}

.live-indicator.active {
    animation: pulse 2s infinite;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Status Messages */
.status-message {
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
}

.status-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Admin Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color), #5b9ee1);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1rem;
    opacity: 0.9;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .login-card {
        padding: 2rem;
        margin: 1rem;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* Search Form */
.search-form {
    margin-bottom: 0;
}

.search-input-group {
    display: flex;
    gap: 1rem;
}

.search-input-group .form-control {
    flex: 1;
}

.search-input-group .btn {
    white-space: nowrap;
}

/* Log Table */
.table-responsive {
    overflow-x: auto;
    margin-top: 1rem;
}

.log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.log-table thead {
    background: var(--background);
}

.log-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border);
}

.log-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.log-table tbody tr {
    transition: background-color 0.2s ease;
}

.log-table tbody tr:hover {
    background-color: var(--background);
}

.log-filename {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-weight: 500;
}

.file-icon {
    margin-right: 0.5rem;
}

.log-date {
    color: var(--text-secondary);
    white-space: nowrap;
}

.log-size {
    color: var(--text-secondary);
    white-space: nowrap;
    text-align: right;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Search Results */
.search-results {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-result-item {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease;
}

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

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.result-file {
    font-weight: 600;
    color: var(--text-primary);
}

.result-line {
    color: var(--text-secondary);
    font-size: 0.875rem;
    background: var(--surface);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
}

.result-content {
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: var(--surface);
    border-radius: 4px;
    border-left: 3px solid var(--primary-color);
}

.result-content code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
    word-break: break-all;
    white-space: pre-wrap;
}

.result-actions {
    display: flex;
    gap: 0.5rem;
}

/* Responsive Table */
@media (max-width: 768px) {
    .log-table {
        font-size: 0.85rem;
    }
    
    .log-table th,
    .log-table td {
        padding: 0.75rem 0.5rem;
    }
    
    /* Hide less important columns on mobile */
    .log-table th:nth-child(4),
    .log-table td:nth-child(4) {
        display: none;
    }
    
    .search-input-group {
        flex-direction: column;
    }
    
    .search-input-group .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    /* On very small screens, hide modified date too */
    .log-table th:nth-child(5),
    .log-table td:nth-child(5) {
        display: none;
    }
}