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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 16px;
}

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

header {
    text-align: center;
    margin-bottom: 32px;
}

header h1 {
    color: #2c3e50;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.header-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.home-button,
.logout-button {
    display: inline-block;
    color: #5a67d8;
    text-decoration: none;
    padding: 10px 20px;
    background: white;
    border: 2px solid #5a67d8;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-button {
    color: #e53e3e;
    border-color: #e53e3e;
}

.home-button:hover {
    background: #5a67d8;
    color: white;
    transform: translateY(-1px);
}

.logout-button:hover {
    background: #e53e3e;
    color: white;
    transform: translateY(-1px);
}

/* Card Styles */
.add-prediction-card,
.timeline-card,
.predictions-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.add-prediction-card h2,
.timeline-card h2,
.predictions-card h2 {
    color: #1a202c;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-prediction-card h2::before {
    content: '';
    width: 4px;
    height: 24px;
    background: #5a67d8;
    border-radius: 2px;
}

.timeline-card h2::before {
    content: '';
    width: 4px;
    height: 24px;
    background: #9f7aea;
    border-radius: 2px;
}

.predictions-card h2::before {
    content: '';
    width: 4px;
    height: 24px;
    background: #48bb78;
    border-radius: 2px;
}

/* Form Styles */
.prediction-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #4a5568;
}

.form-field input,
.form-field textarea,
.form-field select {
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    background: #f7fafc;
    transition: all 0.2s;
    font-family: inherit;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
    outline: none;
    border-color: #5a67d8;
    background: white;
}

.form-field textarea {
    resize: vertical;
}

.form-field input[type="file"] {
    padding: 8px;
    font-size: 0.9rem;
}

/* Tags Input */
.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    min-height: 32px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    color: white;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
}

.tag-remove {
    cursor: pointer;
    font-weight: bold;
    opacity: 0.8;
    margin-left: 4px;
}

.tag-remove:hover {
    opacity: 1;
}

.tags-dropdown-wrapper {
    position: relative;
}

#tags-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    background: #f7fafc;
    transition: all 0.2s;
}

#tags-input:focus {
    outline: none;
    border-color: #5a67d8;
    background: white;
}

.tags-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 240px;
    overflow-y: auto;
    z-index: 100;
}

.tags-dropdown.hidden {
    display: none;
}

.tag-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.tag-dropdown-item:hover {
    background: #f7fafc;
}

.tag-dropdown-item.create-new {
    color: #5a67d8;
    font-weight: 500;
    border-top: 2px solid #e2e8f0;
}

.tag-color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Image Preview */
.image-preview {
    margin-top: 12px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.preview-image {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
}

.preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-image .remove-image {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.preview-image .remove-image:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Buttons */
.prediction-form {
    position: relative;
}

.prediction-form > button {
    margin-right: 12px;
}

.submit-btn {
    padding: 14px 28px;
    background: #5a67d8;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.submit-btn:hover {
    background: #4c51bf;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(90, 103, 216, 0.4);
}

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

/* Timeline Styles */
.timeline-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.timeline-tag-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    align-items: center;
}

.timeline-tag-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    color: white;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.timeline-tag-filter:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.timeline-tag-filter.inactive {
    opacity: 0.4;
    filter: grayscale(0.5);
}

.timeline-tag-filter .count {
    background: rgba(255, 255, 255, 0.3);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.75rem;
}

.control-btn {
    padding: 8px 16px;
    background: #edf2f7;
    color: #4a5568;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.control-btn:hover {
    background: #e2e8f0;
    color: #2d3748;
}

.timeline-container {
    position: relative;
    width: 100%;
    height: 600px;
    overflow: hidden;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    background: #fafbfc;
    cursor: grab;
    touch-action: none;
}

.timeline-container:active {
    cursor: grabbing;
}

#timeline-canvas {
    position: absolute;
    top: 0;
    left: 0;
}

/* Predictions List */
.filter-controls {
    margin-bottom: 20px;
}

.search-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    background: #f7fafc;
    margin-bottom: 12px;
}

.search-input:focus {
    outline: none;
    border-color: #5a67d8;
    background: white;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-tag {
    padding: 6px 12px;
    background: #edf2f7;
    color: #4a5568;
    border-radius: 16px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.filter-tag:hover {
    background: #e2e8f0;
}

.filter-tag.active {
    background: #5a67d8;
    color: white;
    border-color: #4c51bf;
}

.predictions-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.prediction-item {
    padding: 16px;
    background: #f7fafc;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
}

.prediction-item:hover {
    border-color: #5a67d8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(90, 103, 216, 0.2);
}

.prediction-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.prediction-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 4px;
}

.prediction-date {
    font-size: 0.9rem;
    color: #718096;
}

.prediction-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.prediction-actions {
    display: flex;
    gap: 8px;
}

.edit-btn {
    background: #4299e1;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.edit-btn:hover {
    background: #3182ce;
    transform: scale(1.05);
}

.delete-btn {
    background: #fc8181;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.delete-btn:hover {
    background: #f56565;
    transform: scale(1.05);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal.active {
    display: block;
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 32px;
    border-radius: 12px;
    max-width: 700px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #a0aec0;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: #4a5568;
}

.modal-image {
    width: 100%;
    border-radius: 8px;
    margin: 16px 0;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid #e2e8f0;
}

.status-btn {
    flex: 1;
    padding: 18px 32px;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.status-btn.correct {
    background: #48bb78;
    color: white;
}

.status-btn.correct:hover {
    background: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
}

.status-btn.incorrect {
    background: #f56565;
    color: white;
}

.status-btn.incorrect:hover {
    background: #e53e3e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.4);
}

.status-btn.delay {
    background: #718096;
    color: white;
}

.status-btn.delay:hover {
    background: #4a5568;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(113, 128, 150, 0.4);
}

.delay-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 8px;
}

.status-badge.correct {
    background: #c6f6d5;
    color: #22543d;
}

.status-badge.incorrect {
    background: #fed7d7;
    color: #742a2a;
}

.status-badge.delayed {
    background: #feebc8;
    color: #7c2d12;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #a0aec0;
}

/* Mobile Optimization */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .add-prediction-card,
    .timeline-card,
    .predictions-card {
        padding: 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .submit-btn {
        width: 100%;
    }

    .timeline-container {
        height: 400px;
    }

    .modal-content {
        margin: 10% 16px;
        padding: 24px;
    }
}

/* Focus states for accessibility */
.submit-btn:focus-visible,
.control-btn:focus-visible,
.delete-btn:focus-visible,
.home-button:focus-visible,
.logout-button:focus-visible {
    outline: 2px solid #5a67d8;
    outline-offset: 2px;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid #5a67d8;
    outline-offset: -2px;
}
