:root {
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --text-color: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    
    /* Token Colors - Palette pastel pour alterner */
    --token-color-1: #dbeafe; /* Blue 100 */
    --token-color-2: #d1fae5; /* Emerald 100 */
    --token-color-3: #fef3c7; /* Amber 100 */
    --token-color-4: #fce7f3; /* Pink 100 */
    --token-color-5: #e0e7ff; /* Indigo 100 */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 2rem;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    width: 100%;
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
}

/* Input Section */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

label {
    font-weight: 600;
    font-size: 0.9rem;
}

textarea {
    width: 100%;
    height: 120px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Fira Code', monospace;
    font-size: 1rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.controls {
    display: flex;
    gap: 1rem;
}

button {
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

button:active {
    transform: translateY(1px);
}

#tokenize-btn {
    background-color: var(--primary-color);
    color: white;
}

#tokenize-btn:hover {
    background-color: var(--primary-hover);
}

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

.secondary:hover {
    background-color: var(--bg-color);
}

/* Output Section */
.stats-bar {
    display: flex;
    justify-content: space-between;
    background-color: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-family: 'Fira Code', monospace;
    font-weight: 600;
    font-size: 1.2rem;
}

.token-container {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    min-height: 150px;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 4px; /* Espace minimal entre les tokens pour l'esthétique */
    font-family: 'Fira Code', monospace;
    font-size: 1rem;
    line-height: 1.8;
}

.placeholder-text {
    color: var(--text-muted);
    font-style: italic;
    width: 100%;
    text-align: center;
    margin-top: 2rem;
}

/* Token Styling */
.token {
    display: inline-block;
    padding: 0 4px;
    border-radius: 4px;
    cursor: default;
    transition: transform 0.15s, box-shadow 0.15s;
    white-space: pre; /* Important pour préserver les espaces */
    border: 1px solid transparent;
}

.token:hover {
    transform: scale(1.05);
    z-index: 10;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    border-color: rgba(0,0,0,0.1);
    font-weight: 600;
}

/* Token colors classes */
.token-c1 { background-color: var(--token-color-1); color: #1e40af; }
.token-c2 { background-color: var(--token-color-2); color: #065f46; }
.token-c3 { background-color: var(--token-color-3); color: #92400e; }
.token-c4 { background-color: var(--token-color-4); color: #9d174d; }
.token-c5 { background-color: var(--token-color-5); color: #3730a3; }

/* Token Details Panel */
.token-details {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: #1f2937;
    color: white;
    border-radius: 8px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
}

.token-details.visible {
    opacity: 1;
    transform: translateY(0);
}

.token-details h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid #374151;
    padding-bottom: 0.5rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
}

.detail-row .value {
    color: #93c5fd;
}

.hidden {
    display: none;
}
