/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette - Cyberpunk Neon Theme */
    --bg-dark-1: #000000;
    --bg-dark-2: #0a0f0d;
    --bg-dark-3: #0f1612;
    --primary-cyan: #00ffcc;
    --primary-green: #00ff88;
    --accent-cyan: #00e5ff;
    --accent-bright: #39ff14;
    --glow-cyan: rgba(0, 255, 204, 0.6);
    --glow-green: rgba(0, 255, 136, 0.5);
    --text-primary: #ffffff;
    --text-secondary: #a0f0e0;
    --text-muted: #6b8080;
    --error-color: #ff3366;
    --success-color: #00ff88;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    /* Shadows */
    --shadow-glow: 0 0 30px var(--glow-cyan), 0 0 50px var(--glow-green);
    --shadow-panel: 0 8px 32px rgba(0, 0, 0, 0.9);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #000000 0%, #0a0f0d 50%, #000000 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* ===== GLOBAL SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.8);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-cyan) 0%, var(--primary-green) 100%);
    border-radius: 6px;
    border: 2px solid rgba(0, 0, 0, 0.8);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--accent-cyan) 0%, var(--accent-bright) 100%);
    box-shadow: 0 0 10px var(--glow-cyan);
}

/* Firefox scrollbar styling */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-cyan) rgba(0, 0, 0, 0.8);
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(0, 255, 204, 0.1) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    bottom: -50%;
    left: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(0, 255, 136, 0.1) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
}

/* ===== HEADER ===== */
.header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-xl) 0;
}

.title {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-bright) 0%, var(--primary-cyan) 50%, var(--primary-green) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--spacing-sm);
    filter: drop-shadow(0 0 20px var(--glow-cyan)) drop-shadow(0 0 40px var(--glow-green));
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 300;
    letter-spacing: 1px;
}

/* ===== MAIN LAYOUT ===== */
.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: var(--spacing-xl);
}

.left-column {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

.right-column {
    display: flex;
    flex-direction: column;
}

/* ===== PANEL BASE ===== */
.panel {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 255, 204, 0.4);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-panel);
    transition: all 0.3s ease;
}

.panel:hover {
    border-color: rgba(0, 255, 204, 0.7);
    background: rgba(15, 22, 18, 0.8);
    box-shadow: var(--shadow-panel), 0 0 20px var(--glow-cyan);
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--spacing-lg);
    color: var(--text-primary);
}

/* ===== INPUT FIELDS ===== */
.input-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    letter-spacing: 0.5px;
}

.input-textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(0, 255, 204, 0.5);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    color: var(--text-primary);
    font-family: 'Inter', monospace;
    font-size: 1rem;
    resize: vertical;
    transition: all 0.3s ease;
    outline: none;
}

.input-textarea:focus {
    border-color: var(--primary-cyan);
    background: rgba(15, 22, 18, 0.8);
    box-shadow: 0 0 20px var(--glow-cyan);
}

.input-textarea::placeholder {
    color: var(--text-muted);
}

/* ===== BUTTONS ===== */
.action-btn {
    width: 100%;
    margin-top: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-xl);
    background: linear-gradient(135deg, var(--primary-cyan) 0%, var(--primary-green) 100%);
    border: none;
    border-radius: var(--radius-md);
    color: #000000;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px var(--glow-cyan);
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--glow-cyan), 0 12px 40px var(--glow-green);
    background: linear-gradient(135deg, var(--accent-bright) 0%, var(--accent-cyan) 100%);
}

.action-btn:hover::before {
    left: 100%;
}

.action-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.3rem;
}

.copy-btn {
    padding: var(--spacing-xs) var(--spacing-md);
    background: rgba(0, 255, 204, 0.2);
    border: 1px solid var(--primary-cyan);
    border-radius: var(--radius-sm);
    color: var(--primary-cyan);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: rgba(0, 255, 204, 0.4);
    box-shadow: 0 0 15px var(--glow-cyan);
    color: var(--accent-bright);
}

.clear-all-btn {
    padding: var(--spacing-xs) var(--spacing-md);
    background: rgba(255, 68, 102, 0.2);
    border: 1px solid var(--error-color);
    border-radius: var(--radius-sm);
    color: var(--error-color);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-all-btn:hover {
    background: rgba(255, 68, 102, 0.3);
    box-shadow: 0 0 10px rgba(255, 68, 102, 0.4);
}

/* ===== OUTPUT CONTAINERS ===== */
.output-container {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-md);
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(0, 255, 204, 0.5);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.output-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.output-display {
    background: rgba(0, 0, 0, 0.6);
    border-radius: var(--radius-sm);
    padding: var(--spacing-md);
    color: var(--primary-cyan);
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.8;
    word-break: break-all;
    max-height: 300px;
    overflow-y: auto;
}

.output-display::-webkit-scrollbar {
    width: 8px;
}

.output-display::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.output-display::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-cyan) 0%, var(--primary-green) 100%);
    border-radius: 4px;
}

/* ===== ERROR MESSAGE ===== */
.error-message {
    margin-top: var(--spacing-md);
    padding: var(--spacing-md);
    background: rgba(255, 68, 102, 0.15);
    border: 1px solid var(--error-color);
    border-radius: var(--radius-md);
    color: var(--error-color);
    font-size: 0.9rem;
    font-weight: 500;
}

/* ===== HISTORY PANEL ===== */
.history-panel {
    height: calc(100vh - 250px);
    display: flex;
    flex-direction: column;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    flex-shrink: 0;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    min-height: 0;
    margin-bottom: var(--spacing-md);
}

.history-list::-webkit-scrollbar {
    width: 8px;
}

.history-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-cyan) 0%, var(--primary-green) 100%);
    border-radius: 4px;
}

.empty-state {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-muted);
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: var(--spacing-sm);
}

.empty-state-sub {
    font-size: 0.85rem;
}

.history-item {
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(0, 255, 204, 0.4);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    transition: all 0.2s ease;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.history-item:hover {
    border-color: rgba(0, 255, 204, 0.8);
    background: rgba(15, 22, 18, 0.95);
    box-shadow: 0 4px 15px var(--glow-cyan);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.history-type {
    display: inline-block;
    padding: 4px 10px;
    background: linear-gradient(135deg, rgba(0, 255, 204, 0.3), rgba(0, 255, 136, 0.3));
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-cyan);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(0, 255, 204, 0.5);
}

.history-timestamp {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.history-preview {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    word-break: break-word;
    line-height: 1.5;
}

.history-actions {
    display: flex;
    gap: var(--spacing-xs);
}

.history-btn {
    padding: 4px 12px;
    background: rgba(0, 255, 204, 0.15);
    border: 1px solid rgba(0, 255, 204, 0.4);
    border-radius: var(--radius-sm);
    color: var(--primary-cyan);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-btn:hover {
    background: rgba(0, 255, 204, 0.3);
    box-shadow: 0 0 10px var(--glow-cyan);
    color: var(--accent-bright);
}

.delete-btn {
    background: rgba(255, 68, 102, 0.1);
    border-color: rgba(255, 68, 102, 0.3);
    color: var(--error-color);
}

.delete-btn:hover {
    background: rgba(255, 68, 102, 0.2);
}

/* ===== STATISTICS SECTION ===== */
.stats-section {
    flex-shrink: 0;
    padding-top: var(--spacing-md);
    border-top: 1px solid rgba(0, 255, 204, 0.4);
}

.stats-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
    text-align: center;
}

.pie-chart-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
}

.pie-chart {
    width: 100px;
    height: 100px;
    filter: drop-shadow(0 4px 15px var(--glow-cyan));
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.pie-chart:hover {
    transform: scale(1.05);
}

.stats-legend {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    flex: 1;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.legend-item:hover {
    background: rgba(15, 22, 18, 0.8);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.encode-color {
    background: linear-gradient(135deg, var(--primary-cyan) 0%, var(--primary-green) 100%);
    box-shadow: 0 0 8px var(--glow-cyan);
}

.decode-color {
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-bright) 100%);
    box-shadow: 0 0 8px var(--glow-green);
}

.legend-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    flex: 1;
}

.legend-label strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .history-panel {
        height: 400px;
    }
    
    .pie-chart {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: var(--spacing-md);
    }
    
    .title {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 0.95rem;
    }
    
    .panel {
        padding: var(--spacing-md);
    }
    
    .section-title {
        font-size: 1.25rem;
    }
}
