* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #ce171d;
    --primary-dark: #a01016;
    --primary-light: #f5e5e6;
    --secondary: #4d4a4b;
    --secondary-light: #e8e8e8;
    --success: #28a745;
    --danger: #dc3545;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --border: #dee2e6;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-box {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 3rem 2.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.logo-section {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--secondary-light);
}

.logo-image img {
    max-width: 240px;
    height: auto;
    margin-bottom: 1.5rem;
}

.logo-section h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 0.5rem;
}

.logo-section p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.error-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: #fff5f5;
    border: 1px solid #feb2b2;
    border-left: 3px solid var(--primary);
    border-radius: 4px;
    color: #c53030;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--secondary);
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.btn-primary {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: var(--primary);
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    margin-top: 1.5rem;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow);
}

.btn-primary:active {
    transform: translateY(1px);
}

.login-footer {
    margin-top: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Dashboard */
.dashboard-page {
    padding: 0;
    min-height: 100vh;
}

.dashboard-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow-sm);
}

.dashboard-header .container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.dashboard-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dashboard-title h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--secondary);
    margin: 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.back-link:hover {
    background: var(--secondary-light);
    border-color: var(--secondary);
}

.dashboard-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.auto-refresh {
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: 4px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.btn-logout {
    padding: 0.625rem 1.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: var(--bg-secondary);
    border-color: var(--secondary);
}

/* Main Content */
.folder-grid,
.data-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.folder-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.folder-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.5rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.folder-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.folder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--secondary-light);
}

.folder-name {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.folder-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-light);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.folder-name h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--secondary);
    margin: 0;
}

.status-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-connected {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-connected .status-indicator {
    background: var(--success);
}

.status-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-error .status-indicator {
    background: var(--danger);
}

.folder-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-value {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

/* Data Table */
.data-table {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-header {
    background: var(--bg-tertiary);
    border-bottom: 2px solid var(--border);
}

.table-row {
    display: grid;
    grid-template-columns: 2fr 2fr 1.25fr 1fr;
    gap: 1rem;
    padding: 1rem 1.5rem;
}

.table-header .table-row {
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--secondary);
}

.table-body .table-row {
    border-bottom: 1px solid var(--secondary-light);
    transition: background 0.15s ease;
}

.table-body .table-row:last-child {
    border-bottom: none;
}

.table-body .table-row:hover {
    background: var(--bg-secondary);
}

.table-cell {
    display: flex;
    align-items: center;
}

.data-name {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--text-primary);
    font-weight: 500;
}

.data-name svg {
    color: var(--primary);
    flex-shrink: 0;
}

.update-time {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Empty State */
.empty-state {
    max-width: 500px;
    margin: 4rem auto;
    text-align: center;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3rem 2rem;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    background: var(--bg-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.empty-state h2 {
    font-size: 1.5rem;
    color: var(--secondary);
    margin-bottom: 0.75rem;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-header .container {
        flex-direction: column;
        align-items: flex-start;
    }

    .folder-grid {
        grid-template-columns: 1fr;
        padding: 0 1rem;
    }

    .data-container {
        padding: 0 1rem;
    }

    .table-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .table-header {
        display: none;
    }

    .table-cell::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 0.75rem;
        text-transform: uppercase;
        margin-right: 0.5rem;
    }
}