/* CSS Variables */
:root {
    --primary-color: #6c5ce7;
    --primary-hover: #5b4cdb;
    --secondary-color: #a29bfe;
    --accent-color: #fd79a8;
    --background-dark: #1a1a2e;
    --background-card: #16213e;
    --background-input: #0f0f23;
    --text-primary: #ffffff;
    --text-secondary: #b8b8d1;
    --text-muted: #6c6c8a;
    --success-color: #00b894;
    --warning-color: #fdcb6e;
    --danger-color: #e74c3c;
    --border-radius: 12px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--background-dark) 0%, #0f0f23 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

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

/* Header */
header {
    text-align: center;
    padding: 30px 0;
    margin-bottom: 20px;
}

header h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

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

/* Main Content */
main {
    flex: 1;
}

/* Sections */
section {
    background: var(--background-card);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
}

section h2 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.4rem;
}

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

.section-header h2 {
    margin-bottom: 0;
}

.entry-count {
    background: var(--primary-color);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
}

/* Textarea */
textarea {
    width: 100%;
    min-height: 150px;
    padding: 15px;
    background: var(--background-input);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 1rem;
    resize: vertical;
    transition: var(--transition);
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

textarea::placeholder {
    color: var(--text-muted);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(108, 92, 231, 0.4);
}

.btn-secondary {
    background: var(--background-input);
    color: var(--text-secondary);
    border: 1px solid var(--text-muted);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--background-dark);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c0392b;
}

/* Entry Actions */
.entry-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.entries-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Entries List */
.entries-list {
    max-height: 400px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-style: italic;
}

.entry-item {
    background: var(--background-input);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    position: relative;
}

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

.entry-date {
    color: var(--secondary-color);
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.entry-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.entry-delete {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    transition: var(--transition);
}

.entry-delete:hover {
    color: var(--danger-color);
}

/* Analysis Section */
.analysis-section.hidden {
    display: none;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.tab {
    padding: 10px 20px;
    background: var(--background-input);
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.tab:hover {
    background: var(--background-dark);
}

.tab.active {
    background: var(--primary-color);
    color: white;
}

/* Tab Panes */
.tab-pane {
    animation: fadeIn 0.3s ease;
}

.tab-pane.hidden {
    display: none;
}

.tab-pane h3 {
    margin-bottom: 5px;
    color: var(--secondary-color);
}

.tab-pane .description {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Keywords Container */
.keywords-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.keyword-tag {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.keyword-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
}

/* Sentiment Container */
.sentiment-container {
    display: grid;
    gap: 20px;
}

.sentiment-overall {
    text-align: center;
    padding: 30px;
    background: var(--background-input);
    border-radius: var(--border-radius);
}

.sentiment-emoji {
    font-size: 4rem;
    margin-bottom: 10px;
}

.sentiment-label {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.sentiment-score {
    color: var(--text-secondary);
}

.sentiment-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.sentiment-item {
    background: var(--background-input);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.sentiment-item-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 5px;
}

.sentiment-bar {
    height: 8px;
    background: var(--background-dark);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 10px;
}

.sentiment-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.sentiment-bar-fill.positive {
    background: var(--success-color);
}

.sentiment-bar-fill.negative {
    background: var(--danger-color);
}

.sentiment-bar-fill.neutral {
    background: var(--warning-color);
}

/* Themes Container */
.themes-container {
    display: grid;
    gap: 15px;
}

.theme-card {
    background: var(--background-input);
    border-radius: var(--border-radius);
    padding: 20px;
    border-left: 4px solid var(--primary-color);
}

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

.theme-name {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-frequency {
    background: var(--primary-color);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
}

.theme-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.theme-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.theme-keyword {
    background: var(--background-dark);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Word Cloud */
.word-cloud-container {
    min-height: 300px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 30px;
    background: var(--background-input);
    border-radius: var(--border-radius);
}

.cloud-word {
    transition: var(--transition);
    cursor: default;
}

.cloud-word:hover {
    transform: scale(1.1);
    text-shadow: 0 0 20px currentColor;
}

/* Prompts Container */
.prompts-container {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
}

.prompt-card {
    background: var(--background-input);
    border-radius: var(--border-radius);
    padding: 20px;
    border-left: 4px solid var(--accent-color);
}

.prompt-category {
    color: var(--accent-color);
    font-size: 0.85rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.prompt-text {
    font-size: 1.1rem;
    line-height: 1.5;
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 0;
    margin-top: auto;
    color: var(--text-muted);
}

footer a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: var(--transition);
}

footer a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background-input);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .app-container {
        padding: 15px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .tagline {
        font-size: 0.95rem;
    }

    section {
        padding: 20px;
    }

    section h2 {
        font-size: 1.2rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .entry-actions,
    .entries-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        text-align: center;
    }

    .tabs {
        justify-content: flex-start;
    }

    .tab {
        padding: 8px 15px;
        font-size: 0.9rem;
    }

    .sentiment-emoji {
        font-size: 3rem;
    }

    .sentiment-label {
        font-size: 1.2rem;
    }

    .word-cloud-container {
        min-height: 200px;
        padding: 20px;
    }

    .keyword-tag {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    .tagline {
        font-size: 0.85rem;
    }

    section {
        padding: 15px;
    }

    textarea {
        min-height: 120px;
        padding: 12px;
        font-size: 0.95rem;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.95rem;
    }

    .tab {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
}

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

.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}
