* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-primary: #4CAF50;
    --color-primary-dark: #45a049;
    --color-danger: #f44336;
    --color-danger-dark: #da190b;
    --color-bg: #f5f5f5;
    --color-surface: #ffffff;
    --color-text: #333333;
    --color-text-light: #666666;
    --color-border: #ddd;
    --color-shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.card {
    background: var(--color-surface);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px var(--color-shadow);
    margin-bottom: 20px;
}

h1, h2, h3 {
    margin-bottom: 20px;
    color: var(--color-text);
}

h1 {
    font-size: 2rem;
    text-align: center;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.2rem;
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 14px;
    color: var(--color-text-light);
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-danger:hover {
    background: var(--color-danger-dark);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

th {
    font-weight: 600;
    color: var(--color-text-light);
    background: var(--color-bg);
}

tr:hover {
    background: #fafafa;
}

/* Header */
.header {
    background: var(--color-surface);
    box-shadow: 0 2px 4px var(--color-shadow);
    padding: 15px 0;
    margin-bottom: 30px;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    margin: 0;
    font-size: 1.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
}

/* Controls */
.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.controls label {
    margin: 0;
    font-size: 14px;
    color: var(--color-text-light);
}

.controls input,
.controls select {
    width: auto;
    min-width: 100px;
}

/* Visualization Controls */
.visualization-controls {
    background: var(--color-surface);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.control-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    font-size: 12px;
    color: var(--color-text-light);
    margin: 0;
}

.control-group input,
.control-group select {
    width: auto;
    min-width: 100px;
}

/* Timeline Buttons */
.timeline-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.timeline-btn {
    padding: 10px 20px;
    border: 2px solid var(--color-border);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.timeline-btn[data-timeline="Focus Day"] {
    background: #FFF9C4;
    border-color: #FFD700;
    color: #333;
}

.timeline-btn[data-timeline="Focus Day"]:hover {
    background: #FFF176;
}

.timeline-btn[data-timeline="Focus Day"].active {
    background: #FFD700;
    border-color: #FFD700;
    color: #333;
    font-weight: bold;
}

.timeline-btn[data-timeline="Past"] {
    background: #FFCDD2;
    border-color: #FF6B6B;
    color: #333;
}

.timeline-btn[data-timeline="Past"]:hover {
    background: #FF8A80;
}

.timeline-btn[data-timeline="Past"].active {
    background: #FF6B6B;
    border-color: #FF6B6B;
    color: white;
    font-weight: bold;
}

.timeline-btn[data-timeline="Future"] {
    background: #B3E5FC;
    border-color: #87CEEB;
    color: #333;
}

.timeline-btn[data-timeline="Future"]:hover {
    background: #81D4FA;
}

.timeline-btn[data-timeline="Future"].active {
    background: #87CEEB;
    border-color: #87CEEB;
    color: #333;
    font-weight: bold;
}

.timeline-btn[data-timeline="Undefined"] {
    background: #E0E0E0;
    border-color: #808080;
    color: #333;
}

.timeline-btn[data-timeline="Undefined"]:hover {
    background: #BDBDBD;
}

.timeline-btn[data-timeline="Undefined"].active {
    background: #808080;
    border-color: #808080;
    color: white;
    font-weight: bold;
}

/* Time Inputs */
.time-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.time-inputs input:disabled,
.time-inputs select:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

/* Edit Mode Banner */
#edit-mode-banner {
    background: #fff3cd;
    border: 1px solid #ffc107;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    display: none;
}

/* Paragraphs List */
.paragraphs-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    margin-top: 20px;
}

.paragraph-item {
    padding: 10px 15px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.paragraph-item:hover {
    background: var(--color-bg);
}

.paragraph-item:last-child {
    border-bottom: none;
}

.paragraph-info {
    flex: 1;
}

.paragraph-actions {
    display: flex;
    gap: 5px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--color-text-light);
}

/* Error */
.error {
    background: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border-left: 4px solid #c62828;
}

/* Success */
.success {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border-left: 4px solid #2e7d32;
}

/* Canvas Container */
.canvas-container {
    background: #fafafa;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 20px;
    overflow: auto;
}

canvas {
    display: block;
    background: white;
    border: 1px solid #eee;
}

/* Legend */
.legend {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 13px;
    margin-top: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid #333;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 400px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-light);
}

.empty-state h3 {
    margin-bottom: 10px;
    color: var(--color-text);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header-content {
        flex-direction: column;
        gap: 10px;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .controls input,
    .controls select {
        width: 100%;
    }

    .timeline-buttons {
        flex-wrap: wrap;
    }

    .time-inputs {
        flex-direction: column;
        align-items: stretch;
    }
}