/* Kamus Madura-Indonesia - Clean Minimalist Style */

:root {
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --bg: #fafafa;
    --surface: #ffffff;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --success: #10b981;
    --warning: #f59e0b;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Loading State */
#loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 16px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* App Container */
#app {
    display: none;
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 32px;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.header .subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}

#stats {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 8px;
}

/* Search Box */
.search-box {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 16px;
    margin-bottom: 24px;
}

.mode-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    margin-bottom: 12px;
    background: var(--bg);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.mode-toggle:hover {
    background: var(--border);
}

.mode-from {
    color: var(--primary);
    font-weight: 600;
}

.mode-arrow {
    color: var(--text-muted);
}

.mode-to {
    color: var(--success);
    font-weight: 600;
}

.search-input-group {
    display: flex;
    gap: 8px;
}

.search-input-group input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-input-group input:focus {
    border-color: var(--primary);
}

.search-input-group input::placeholder {
    color: var(--text-muted);
}

.btn {
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--border);
}

/* Word of Day */
#wordOfDay {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
    text-align: center;
}

.wod-label {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-bottom: 8px;
}

.wod-madura {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.wod-indonesia {
    font-size: 1rem;
    opacity: 0.9;
}

/* Results */
#results {
    min-height: 200px;
}

.no-results,
.not-found {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.not-found-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.not-found-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Suggestions */
.suggestions {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: var(--bg);
}

.suggestion-source {
    font-weight: 600;
    color: var(--primary);
}

.suggestion-arrow {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.suggestion-target {
    color: var(--text-secondary);
    flex: 1;
}

/* Results List */
.results-header {
    padding: 12px 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.results-list {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.result-item:last-child {
    border-bottom: none;
}

.result-source {
    flex: 1;
    font-weight: 600;
    color: var(--text);
}

.result-source mark {
    background: #fef08a;
    padding: 1px 4px;
    border-radius: 2px;
}

.result-arrow {
    color: var(--text-muted);
}

.result-target {
    flex: 1;
    color: var(--text-secondary);
}

/* Translation Result */
.translation-result {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    text-align: center;
}

.translation-source {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.translation-arrow {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin: 8px 0;
}

.translation-target {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success);
}

/* Sentence Result */
.sentence-result {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
}

.sentence-original {
    font-size: 1.125rem;
    color: var(--text);
    margin-bottom: 8px;
}

.sentence-arrow {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin: 8px 0;
}

.sentence-translated {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--success);
}

/* Word Breakdown */
.word-breakdown {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.breakdown-title {
    padding: 12px 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg);
}

.breakdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.breakdown-item:last-child {
    border-bottom: none;
}

.breakdown-item.found .breakdown-translation {
    color: var(--success);
}

.breakdown-item.not-found {
    opacity: 0.6;
}

.breakdown-arrow {
    color: var(--text-muted);
}

/* Tingkat Badges */
.tingkat-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-left: 6px;
}

.tingkat-lomrah {
    background: #dbeafe;
    color: #1e40af;
}

.tingkat-alos {
    background: #dcfce7;
    color: #166534;
}

.tingkat-alos-tengghi {
    background: #fef3c7;
    color: #92400e;
}

.tingkat-tengngaan {
    background: #f3e8ff;
    color: #7c3aed;
}

#wordOfDay .tingkat-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Recent Searches */
.recent-searches {
    padding: 16px 0;
}

.recent-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recent-item {
    display: inline-block;
    padding: 8px 14px;
    margin: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.recent-item:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Error */
.error-message {
    background: #fef2f2;
    color: #dc2626;
    padding: 16px;
    border-radius: var(--radius);
    text-align: center;
}

/* Responsive */
@media (max-width: 480px) {
    #app {
        padding: 16px 12px;
    }

    .header h1 {
        font-size: 1.25rem;
    }

    .search-input-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .result-arrow {
        display: none;
    }
}

/* Live Translation (Word-by-Word) */
.live-translation {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
    text-align: center;
}

.live-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.live-result {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.8;
}

.live-word-found {
    color: var(--success);
}

.live-word-not-found {
    color: #dc2626;
    font-style: italic;
    text-decoration: underline;
    text-decoration-style: wavy;
    text-decoration-color: #fca5a5;
}

.live-breakdown {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.live-word-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.live-word-item:last-child {
    border-bottom: none;
}

.live-word-original {
    font-weight: 600;
    color: var(--text);
    min-width: 80px;
}

.live-word-arrow {
    color: var(--text-muted);
}

.live-word-translation {
    flex: 1;
}

.live-word-item.found .live-word-translation {
    color: var(--success);
    font-weight: 500;
}

.live-word-item.not-found .live-word-translation {
    color: #dc2626;
    font-style: italic;
}

.live-word-status {
    font-size: 0.875rem;
    width: 20px;
    text-align: center;
}

.live-word-item.found .live-word-status {
    color: var(--success);
}

.live-word-item.not-found .live-word-status {
    color: #dc2626;
}