* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2196F3;
    --secondary: #4CAF50;
    --danger: #f44336;
    --warning: #ff9800;
    --dark: #212121;
    --light: #f5f5f5;
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--dark);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    animation: fadeInDown 0.6s ease-out;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 20px;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.stats span {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
}

/* Controls */
.controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 30px;
    animation: fadeInUp 0.6s ease-out;
}

.controls button,
.controls select,
.controls input {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    color: var(--dark);
    box-shadow: 0 4px 15px var(--shadow);
}

.controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow);
}

.controls button.active {
    background: var(--primary);
    color: white;
}

.controls select {
    min-width: 200px;
}

.controls input[type="search"] {
    min-width: 300px;
}

/* Loading & Error */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: white;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: var(--danger);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    margin: 20px 0;
}

/* Galaxy View */
#galaxy-view {
    position: relative;
    width: 100%;
    height: 80vh;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

#galaxy-canvas {
    width: 100%;
    height: 100%;
    cursor: grab;
}

#galaxy-canvas:active {
    cursor: grabbing;
}

#galaxy-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px;
    border-radius: 10px;
    max-width: 300px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#galaxy-overlay.visible {
    opacity: 1;
}

/* Timeline View */
#timeline-view {
    padding: 40px 0;
}

#timeline-container {
    position: relative;
    padding: 20px;
}

.timeline-item {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
    opacity: 0;
    transform: translateX(-30px);
    animation: slideInLeft 0.5s ease-out forwards;
}

.timeline-item:nth-child(even) {
    flex-direction: row-reverse;
    transform: translateX(30px);
    animation: slideInRight 0.5s ease-out forwards;
}

.timeline-date {
    flex-shrink: 0;
    width: 150px;
    text-align: right;
    padding-top: 10px;
    color: white;
    font-weight: 600;
}

.timeline-item:nth-child(even) .timeline-date {
    text-align: left;
}

.timeline-card {
    flex: 1;
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 20px var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
}

.timeline-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow);
}

/* Grid View */
#grid-view {
    padding: 20px 0;
}

#grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.bookmark-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.9);
    animation: popIn 0.4s ease-out forwards;
}

.bookmark-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 40px var(--shadow);
}

.bookmark-screenshot {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.bookmark-content {
    padding: 20px;
}

.bookmark-topic {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    margin-bottom: 10px;
}

.bookmark-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--dark);
}

.bookmark-description {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
    line-height: 1.6;
}

.bookmark-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #999;
}

.bookmark-url {
    color: var(--primary);
    text-decoration: none;
    font-size: 13px;
    display: block;
    margin-bottom: 10px;
    word-break: break-all;
}

.bookmark-url:hover {
    text-decoration: underline;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: scaleIn 0.3s ease-out;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 30px;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-screenshot {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 20px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes popIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .stats {
        gap: 15px;
    }

    .controls {
        flex-direction: column;
    }

    .controls button,
    .controls select,
    .controls input {
        width: 100%;
    }

    #grid-container {
        grid-template-columns: 1fr;
    }

    .timeline-item,
    .timeline-item:nth-child(even) {
        flex-direction: column;
    }

    .timeline-date {
        width: 100%;
        text-align: left !important;
    }

    .modal-content {
        padding: 20px;
        margin: 20px;
    }
}
