@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.05);
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-blur: 20px;
    --accent: #818cf8;
    --success: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 40px 20px;
    position: relative;
    overflow-x: hidden;
    width: 100%;
    scroll-behavior: smooth;
}

/* Background Blobs */
.bg-blobs {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    width: 600px;
    height: 600px;
    background: var(--primary-gradient);
    filter: blur(80px);
    border-radius: 50%;
    opacity: 0.12;
    will-change: transform;
}

.blob-1 {
    top: -10%;
    right: -10%;
}

.blob-2 {
    bottom: -10%;
    left: -10%;
    animation-delay: -5s;
}

/* Calculator Card */
.calculator-card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: 28px;
    padding: 30px 40px;
    width: 100%;
    max-width: 900px;
    /* Slightly wider for the editor */
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
    will-change: transform, opacity;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

header {
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

header p {
    color: #94a3b8;
    font-size: 1rem;
}

/* Editor Section */
.editor-section {
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

/* Toolbar */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-color);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 5px;
}

.tool-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #cbd5e1;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.tool-btn.active {
    background: rgba(129, 140, 248, 0.2);
    color: var(--accent);
    border-color: rgba(129, 140, 248, 0.3);
}

.font-size-select {
    background: rgba(15, 23, 42, 0.8);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 8px;
    outline: none;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s;
}

.font-size-select:focus {
    border-color: var(--accent);
}

/* Text Editor */
.editor-container {
    flex: 1;
    padding: 20px;
    position: relative;
    min-height: 250px;
}

.text-editor {
    width: 100%;
    min-height: 250px;
    max-height: 400px;
    outline: none;
    color: #f8fafc;
    font-size: 1.1rem;
    line-height: 1.6;
    overflow-y: auto;
    font-family: inherit;
    position: relative;
    z-index: 1;
    /* For placeholder */
}

/* Custom scrollbar for editor */
.text-editor::-webkit-scrollbar {
    width: 8px;
}

.text-editor::-webkit-scrollbar-track {
    background: transparent;
}

.text-editor::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.text-editor::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Placeholder logic */
.text-editor:empty:before {
    content: attr(data-placeholder);
    color: #64748b;
    pointer-events: none;
    display: block;
    /* For Firefox */
    font-style: italic;
}

/* Stats Panel */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 15px 20px;
    text-align: center;
    transition: transform 0.3s, background 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.stat-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.06);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.highlight-card {
    background: rgba(129, 140, 248, 0.1);
    border-color: rgba(129, 140, 248, 0.2);
}

.highlight-card .stat-value {
    color: var(--accent);
}

.time-card {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
}

.time-card .stat-value {
    color: var(--success);
}

/* Responsive */
@media (max-width: 768px) {
    .calculator-card {
        padding: 25px 15px;
    }

    .stats-panel {
        grid-template-columns: repeat(2, 1fr);
    }

    .toolbar {
        justify-content: center;
    }

    .toolbar-group {
        flex-wrap: wrap;
        justify-content: center;
    }

    .text-editor {
        min-height: 200px;
    }
}

@media (max-width: 480px) {
    .stats-panel {
        grid-template-columns: 1fr;
    }
}