/* CSS Variables - Vibrant Light Theme */
:root {
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-4: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --gradient-5: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    --gradient-bg: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    --gradient-hot: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%);

    --primary: #667eea;
    --primary-light: #8b9ff5;
    --secondary: #f093fb;
    --accent: #00d4ff;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --hot: #ff6b6b;

    --bg-light: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --bg-input: rgba(255, 255, 255, 0.9);
    --border-color: rgba(102, 126, 234, 0.15);
    --border-hover: rgba(102, 126, 234, 0.3);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    --radius: 20px;
    --radius-sm: 12px;
    --shadow: 0 4px 24px rgba(102, 126, 234, 0.1);
    --shadow-hover: 0 8px 40px rgba(102, 126, 234, 0.15);
    --shadow-glow: 0 0 60px rgba(102, 126, 234, 0.2);

    /* Theme transition speed */
    --theme-transition: 0.3s ease;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Base */
html {
    font-size: 14px;
}

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

/* Animated Background Decorations */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
    filter: blur(80px);
    opacity: 0.5;
}

body::before {
    top: -20%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3) 0%, rgba(240, 147, 251, 0.3) 100%);
    animation: float1 20s ease-in-out infinite;
}

body::after {
    bottom: -20%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.3) 0%, rgba(0, 242, 254, 0.2) 100%);
    animation: float2 25s ease-in-out infinite;
}

@keyframes float1 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(5deg); }
    66% { transform: translate(-20px, 20px) rotate(-5deg); }
}

@keyframes float2 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-30px, 30px) rotate(-5deg); }
    66% { transform: translate(20px, -20px) rotate(5deg); }
}

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

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.5rem 0;
}

.header__title {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
    background: var(--gradient-5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 4px 20px rgba(250, 112, 154, 0.3));
    animation: titlePulse 3s ease-in-out infinite;
    transition: background var(--theme-transition);
}

@keyframes titlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

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

.header__limit {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    font-size: 0.85rem;
}

.limit-label {
    color: var(--text-muted);
    font-weight: 500;
}

.remaining-counter {
    font-weight: 700;
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.remaining-counter.remaining--low {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.remaining-counter.remaining--critical {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
    animation: pulse 1s ease-in-out infinite;
}

/* Main - Two Column Layout */
.main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.5rem;
    align-items: start;
}

.main__left {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.main__right {
    position: sticky;
    top: 1rem;
}

/* Card */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-hover);
}

.card--slangs {
    max-height: calc(100vh - 180px);
    display: flex;
    flex-direction: column;
}

.card--result {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(240, 147, 251, 0.08) 100%);
    border: 2px solid rgba(102, 126, 234, 0.2);
    box-shadow: var(--shadow), var(--shadow-glow);
}

.card--result:hover {
    border-color: rgba(102, 126, 234, 0.4);
}

/* Label */
.label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Textarea */
.textarea-wrapper {
    position: relative;
}

.textarea {
    width: 100%;
    min-height: 180px;
    padding: 1rem;
    padding-right: 3rem;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    resize: vertical;
    transition: all 0.3s ease;
}

.textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15), 0 4px 20px rgba(102, 126, 234, 0.1);
    background: white;
}

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

.clear-btn {
    position: absolute;
    top: 0.875rem;
    right: 0.875rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error);
    color: var(--error);
    transform: scale(1.1);
}

/* Character Counter */
.char-counter {
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
    font-weight: 600;
}

.char-counter--warning {
    color: var(--warning);
}

.char-counter--limit {
    color: var(--error);
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Search */
.search-wrapper {
    position: relative;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(0, 212, 255, 0.15);
    background: white;
}

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

/* Slang List - Vertical Column */
.slang-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    flex: 1;
    padding-right: 0.25rem;
}

.slang-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.slang-item:hover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.slang-item--selected {
    background: var(--gradient-1);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.35);
    transition: background var(--theme-transition), box-shadow var(--theme-transition);
}

.slang-item--selected:hover {
    background: var(--gradient-1);
    color: white;
    transform: translateX(4px) scale(1.01);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.4);
}

.slang-item--hidden {
    display: none;
}

/* Hot Badge */
.slang-item--hot {
    border-color: rgba(255, 107, 107, 0.3);
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.05) 0%, rgba(254, 202, 87, 0.05) 100%);
}

.slang-item--hot:hover {
    border-color: var(--hot);
}

.slang-item--hot.slang-item--selected {
    background: var(--gradient-hot);
}

.slang-item--hot.slang-item--selected:hover {
    background: var(--gradient-hot);
    color: white;
}

.hot-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    background: var(--gradient-hot);
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: auto;
    flex-shrink: 0;
    animation: hotPulse 2s ease-in-out infinite;
}

@keyframes hotPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.slang-radio {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    flex-shrink: 0;
    transition: all 0.2s ease;
    position: relative;
}

.slang-item:hover .slang-radio {
    border-color: var(--primary);
}

.slang-item--hot .slang-radio {
    border-color: rgba(255, 107, 107, 0.5);
}

.slang-item--hot:hover .slang-radio {
    border-color: var(--hot);
}

.slang-item--selected .slang-radio {
    border-color: white;
    background: white;
}

.slang-item--selected .slang-radio::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
}

.slang-item--hot.slang-item--selected .slang-radio::after {
    background: var(--hot);
}

.slang-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Slang Description */
.slang-description {
    margin-top: 1rem;
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.08) 0%, rgba(79, 172, 254, 0.08) 100%);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-left: 3px solid var(--accent);
    flex-shrink: 0;
}

/* Button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 1.125rem 2rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn--primary {
    background: var(--gradient-1);
    color: white;
    width: 100%;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.35);
    position: relative;
    overflow: hidden;
    transition: background var(--theme-transition), box-shadow var(--theme-transition);
}

.btn--primary::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.6s ease;
}

.btn--primary:hover:not(:disabled)::before {
    left: 100%;
}

.btn--primary:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.45);
}

.btn--primary:active:not(:disabled) {
    transform: translateY(-1px);
}

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

/* Loader */
.loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Result */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.result-header .label {
    margin-bottom: 0;
    background: var(--gradient-4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1rem;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(1.05);
}

.copy-btn--success {
    background: var(--gradient-4);
    color: white;
    border-color: transparent;
}

.result-text {
    font-size: 1.15rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 1.25rem;
    background: white;
    border-radius: var(--radius-sm);
    border-left: 4px solid;
    border-image: var(--gradient-5) 1;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.result-meta {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.result-meta::before {
    content: '✨';
}

/* History */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.history-header .label {
    margin-bottom: 0;
}

.clear-history-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease;
}

.clear-history-btn:hover {
    color: var(--error);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.history-item {
    padding: 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-item:hover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.03);
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.1);
}

.history-item__original {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item__translated {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    font-weight: 500;
}

.history-item__slang {
    font-size: 0.65rem;
    color: var(--primary);
    margin-top: 0.375rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 1rem 2rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.toast--visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast--error {
    background: var(--gradient-2);
    color: white;
}

.toast--success {
    background: var(--gradient-4);
    color: #1a1a2e;
}

/* Footer */
.footer {
    text-align: center;
    padding-top: 2rem;
    margin-top: auto;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
}

.footer p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.footer p::before {
    content: '⚡';
}

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

::-webkit-scrollbar-track {
    background: rgba(102, 126, 234, 0.05);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gradient-2);
}

/* Selection */
::selection {
    background: rgba(102, 126, 234, 0.2);
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 900px) {
    .main {
        grid-template-columns: 1fr;
    }

    .main__right {
        position: static;
        order: -1;
    }

    .card--slangs {
        max-height: 350px;
    }

    .slang-list {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .slang-item {
        flex: 0 0 auto;
    }
}

@media (max-width: 480px) {
    .header__title {
        font-size: 2.5rem;
    }

    .btn--primary {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }

    .result-text {
        font-size: 1.05rem;
    }

    .container {
        padding: 1rem;
    }
}

/* Animations on load */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.header {
    animation: fadeInUp 0.6s ease forwards;
}

.main__left .card {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
}

.main__left .card:nth-child(1) { animation-delay: 0.15s; }
.main__left .card:nth-child(2) { animation-delay: 0.3s; }
.main__left .card:nth-child(3) { animation-delay: 0.45s; }

.main__right {
    animation: fadeInRight 0.6s ease forwards;
    animation-delay: 0.2s;
    opacity: 0;
}

.btn--primary {
    animation: fadeInUp 0.6s ease forwards;
    animation-delay: 0.35s;
    opacity: 0;
}

/* Screen reader only - for accessibility */
.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;
}
