/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background: #f5f5f5;
}

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

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-box h1 {
    font-size: 24px;
    margin-bottom: 8px;
    color: #333;
}

.login-box h2 {
    font-size: 16px;
    margin-bottom: 30px;
    color: #666;
    font-weight: normal;
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #fcc;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
}

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

/* Dashboard Page */
.dashboard-page {
    background: #f5f5f5;
}

/* Header */
.header {
    background: white;
    padding: 16px 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header h1 {
    font-size: 20px;
    color: #333;
}

.current-time {
    color: #666;
    font-size: 14px;
}

.btn-logout {
    padding: 8px 16px;
    background: #f44336;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: #d32f2f;
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.section {
    background: white;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.section h2 {
    font-size: 18px;
    margin-bottom: 20px;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.card-queued {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.card-processing {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.card-done {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.card-error {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.card-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.card-value {
    font-size: 32px;
    font-weight: bold;
}

/* Resources */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.resource-item {
    padding: 16px;
    background: #f9f9f9;
    border-radius: 6px;
}

.resource-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.progress-bar {
    height: 28px;
    background: #e0e0e0;
    border-radius: 14px;
    position: relative;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.5s ease;
    border-radius: 14px;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 500;
    color: #333;
    z-index: 1;
}

/* Split Section */
.split-section {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
}

.split-left, .split-right {
    padding: 0;
}

.split-section h2 {
    font-size: 16px;
    margin-bottom: 16px;
}

.btn-small {
    padding: 4px 12px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    margin-left: 10px;
}

/* Current Job */
.current-job {
    background: #f9f9f9;
    border-radius: 6px;
    padding: 16px;
    min-height: 200px;
}

.no-job {
    color: #999;
    text-align: center;
    padding: 40px 0;
}

.job-info {
    font-size: 13px;
}

.job-info-row {
    margin-bottom: 12px;
    display: flex;
}

.job-info-label {
    font-weight: 500;
    color: #666;
    min-width: 100px;
}

.job-info-value {
    color: #333;
    word-break: break-all;
}

/* Logs */
.logs-container {
    background: #1e1e1e;
    color: #d4d4d4;
    border-radius: 6px;
    padding: 16px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    height: 400px;
    overflow-y: auto;
}

.log-line {
    margin-bottom: 4px;
    line-height: 1.4;
}

/* Analytics */
.period-filter {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.btn-period {
    padding: 8px 16px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-period:hover {
    background: #e8e8e8;
}

.btn-period.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.analytics-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.analytics-card {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 6px;
    text-align: center;
}

.analytics-card .card-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.analytics-card .card-value {
    font-size: 28px;
    font-weight: bold;
    color: #333;
}

/* Chart */
.chart-container {
    margin-bottom: 24px;
    height: 300px;
}

/* Top Tenants Table */
.top-tenants h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: #333;
}

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

.tenants-table th {
    background: #f5f5f5;
    padding: 12px;
    text-align: left;
    font-weight: 500;
    color: #666;
    font-size: 13px;
}

.tenants-table td {
    padding: 12px;
    border-top: 1px solid #eee;
    font-size: 13px;
}

.tenants-table td.loading {
    text-align: center;
    color: #999;
}

/* Scrollbar */
.logs-container::-webkit-scrollbar {
    width: 8px;
}

.logs-container::-webkit-scrollbar-track {
    background: #2d2d2d;
}

.logs-container::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.logs-container::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Collapsible sections */
.btn-toggle {
    padding: 4px 12px;
    background: #e0e0e0;
    color: #333;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 10px;
    transition: background 0.2s;
}

.btn-toggle:hover {
    background: #d0d0d0;
}

.collapsible-content {
    transition: all 0.3s ease;
    max-height: 1000px;
    opacity: 1;
}

.collapsible-content.hidden {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    overflow: hidden;
}