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

:root {
    --primary-color: #ff0000;
    --primary-dark: #cc0000;
    --secondary-color: #282828;
    --background: #0f0f0f;
    --surface: #1a1a1a;
    --surface-light: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --text-muted: #666666;
    --border: #333333;
    --success: #00d084;
    --warning: #ff9500;
    --error: #ff4444;
    --shadow: rgba(0, 0, 0, 0.3);
    --gradient: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Animation */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 0, 0, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 0, 0, 0.05) 0%, transparent 50%);
    z-index: -1;
    animation: backgroundShift 20s ease-in-out infinite;
}

@keyframes backgroundShift {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    padding: 40px 0;
    text-align: center;
    position: relative;
}

.header-content {
    position: relative;
    z-index: 1;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo i {
    font-size: 3rem;
    color: var(--primary-color);
    filter: drop-shadow(0 0 20px rgba(255, 0, 0, 0.3));
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Input Section */
.input-section {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.input-container {
    width: 100%;
    max-width: 600px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--border-radius);
    padding: 8px;
    transition: var(--transition);
    box-shadow: 0 4px 20px var(--shadow);
}

.input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 4px 30px rgba(255, 0, 0, 0.2);
}

.input-icon {
    color: var(--text-muted);
    margin: 0 15px;
    font-size: 1.1rem;
}

.url-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1rem;
    padding: 12px 0;
    font-family: inherit;
}

.url-input::placeholder {
    color: var(--text-muted);
}

.extract-btn {
    background: var(--gradient);
    border: none;
    border-radius: 8px;
    color: white;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: 0 2px 10px rgba(255, 0, 0, 0.3);
}

.extract-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(255, 0, 0, 0.4);
}

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

.extract-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.input-help {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 60px 20px;
}

.loading-spinner {
    margin-bottom: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Error Message */
.error-message {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid var(--error);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    color: var(--error);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 500;
}

/* Results Section */
.results-section {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: 0 8px 40px var(--shadow);
    border: 1px solid var(--border);
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.results-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 600;
}

.results-header h2 i {
    color: var(--primary-color);
}

.results-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.count-badge {
    background: var(--primary-color);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.cache-badge {
    background: var(--success);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Results Controls */
.results-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.control-btn {
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 10px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    font-weight: 500;
}

.control-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* Timestamps List */
.timestamps-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.timestamp-item {
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.timestamp-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 20px rgba(255, 0, 0, 0.1);
}

.timestamp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.timestamp-time {
    display: flex;
    align-items: center;
    gap: 10px;
}

.timestamp-time .time {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
}

.reference-count {
    background: var(--warning);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.timestamp-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    padding: 8px 12px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.action-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.timestamp-comments {
    margin-top: 15px;
}

.comment-item {
    background: var(--background);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    border-left: 3px solid var(--primary-color);
}

.comment-item:last-child {
    margin-bottom: 0;
}

/* Footer */
.footer {
    padding: 30px 0;
    text-align: center;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

.footer p {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 15px 20px;
    color: var(--text-primary);
    box-shadow: 0 4px 20px var(--shadow);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    animation: slideIn 0.3s ease-out;
}

.toast.success {
    border-color: var(--success);
    background: rgba(0, 208, 132, 0.1);
}

.toast.error {
    border-color: var(--error);
    background: rgba(255, 68, 68, 0.1);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .logo i {
        font-size: 2.5rem;
    }
    
    .input-wrapper {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }
    
    .extract-btn {
        width: 100%;
        justify-content: center;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .results-controls {
        flex-direction: column;
    }
    
    .control-btn {
        justify-content: center;
    }
    
    .timestamp-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .timestamp-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .toast {
        min-width: auto;
        width: calc(100vw - 40px);
    }
}

@media (max-width: 480px) {
    .header {
        padding: 20px 0;
    }
    
    .logo {
        flex-direction: column;
        gap: 10px;
    }
    
    .results-section {
        padding: 20px;
    }
    
    .timestamp-item {
        padding: 15px;
    }
}
