:root {
    /* Modern Light Theme dengan Cyan-Teal Accent */
    --bg-deep: #f8fafc;
    --bg-base: #ffffff;
    --bg-elevated: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    
    /* Accent Colors - Cyan to Teal Gradient */
    --accent-primary: #0891b2;
    --accent-secondary: #06b6d4;
    --accent-tertiary: #0e7490;
    --accent-glow: rgba(8, 145, 178, 0.15);
    --accent-soft: rgba(8, 145, 178, 0.08);
    --accent-subtle: rgba(6, 182, 212, 0.06);
    
    /* Neutral Palette */
    --border-subtle: rgba(148, 163, 184, 0.25);
    --border-active: rgba(8, 145, 178, 0.5);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    /* Semantic Colors */
    --success: #059669;
    --success-soft: rgba(5, 150, 105, 0.1);
    --warning: #d97706;
    --warning-soft: rgba(217, 119, 6, 0.1);
    --danger: #dc2626;
    --danger-soft: rgba(220, 38, 38, 0.1);
    --info: #0284c7;
    --info-soft: rgba(2, 132, 199, 0.1);
    
    /* Radius & Shadows */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 24px rgba(8, 145, 178, 0.12);
    --shadow-card: 
        0 1px 3px rgba(0, 0, 0, 0.04),
        0 4px 12px rgba(0, 0, 0, 0.06);
}

/* ===== BADGE COMPONENTS ===== */
.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.badge-success {
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid rgba(5, 150, 105, 0.2);
}

.badge-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.status-text {
    font-size: 0.75rem;
    font-weight: 600;
}

/* ===== MODAL API KEY ===== */
#apiKeyModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    background: rgba(15, 23, 42, 0.4);
    z-index: 9999;
}

#apiKeyModal.show {
    display: flex !important;
}

.api-key-box {
    background: linear-gradient(
        165deg,
        rgba(255, 255, 255, 0.98) 0%,
        rgba(248, 250, 252, 0.98) 100%
    );
    border: 1px solid rgba(8, 145, 178, 0.15);
    padding: 28px 32px;
    width: 380px;
    border-radius: var(--radius-xl);
    box-shadow: 
        0 0 0 1px rgba(0, 0, 0, 0.03),
        0 20px 50px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(20px);
    animation: modalSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.api-key-box h2 {
    margin-top: 0;
    font-size: 1.25rem;
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.doi-link {
    color: var(--accent-primary);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.doi-link:hover {
    color: var(--accent-tertiary);
    text-decoration: underline;
}

.api-key-box p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Modal Label */
.modal-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

/* Input Fields */
.api-input,
.modal-input,
#apiKeyInput {
    width: 100%;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    transition: 
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

.api-input::placeholder,
.modal-input::placeholder,
#apiKeyInput::placeholder {
    color: var(--text-muted);
    opacity: 0.8;
}

.api-input:focus,
.modal-input:focus,
#apiKeyInput:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: #ffffff;
    box-shadow: 
        0 0 0 3px rgba(8, 145, 178, 0.1),
        0 0 0 1px rgba(8, 145, 178, 0.2);
}

.modal-hint {
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.modal-hint code {
    background: #f1f5f9;
    padding: 3px 8px;
    border-radius: 6px;
    color: var(--accent-primary);
    font-size: 0.7rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.apiKeyActions {
    margin-top: 24px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.apiKeyBtn {
    flex: 1;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border: none;
    font-family: inherit;
}

.apiKeyBtn.save {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-tertiary) 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(8, 145, 178, 0.25);
}

.apiKeyBtn.save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(8, 145, 178, 0.35);
}

.apiKeyBtn.cancel {
    background: #f8fafc;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.apiKeyBtn.cancel:hover {
    background: #f1f5f9;
    border-color: rgba(148, 163, 184, 0.4);
    color: var(--text-primary);
}

#apiKeyStatus {
    margin-top: 12px;
    font-size: 0.8rem;
    text-align: center;
    color: var(--text-muted);
}

#apiKeyStatus .badge-success {
    color: var(--success) !important;
}

#apiKeyStatus .badge-danger {
    color: var(--danger) !important;
}

/* ===== BASE STYLES ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 50%, #f1f5f9 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 24px 16px 16px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
}

/* Subtle Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(8, 145, 178, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(6, 182, 212, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    width: 100%;
    max-width: 1160px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* ===== HEADER ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.title-group h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.title-group h1 span {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.title-group p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 6px;
    max-width: 540px;
    line-height: 1.5;
}

/* ===== LAYOUT GRID ===== */
.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
}

@media (max-width: 900px) {
    .layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ===== CARD COMPONENT ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    padding: 22px 24px 20px;
    transition: 
        transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.3s ease,
        border-color 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, 
        var(--accent-primary) 0%,
        var(--accent-secondary) 50%,
        var(--accent-primary) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 12px 28px rgba(0, 0, 0, 0.08),
        0 4px 12px rgba(0, 0, 0, 0.04);
    border-color: rgba(8, 145, 178, 0.2);
}

.card:hover::before {
    opacity: 1;
}

.card-full {
    width: 100%;
    grid-column: 1 / -1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}

.card-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== FORM ELEMENTS ===== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
    margin-top: 8px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.82rem;
}

.form-group.full {
    grid-column: 1 / -1;
}

label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.8rem;
}

input[type="text"],
input[type="number"],
select,
textarea {
    background: #f8fafc;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: 
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
    font-family: inherit;
}

textarea {
    resize: vertical;
    min-height: 60px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.08);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.input-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.required {
    color: var(--danger);
}

.btn-row {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

/* ===== BUTTON STYLES ===== */
.btn {
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    padding: 10px 18px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-height: 40px;
    font-family: inherit;
}

/* Primary Button */
.btn:not(.secondary):not(.danger):not(.ai) {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-tertiary) 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(8, 145, 178, 0.2);
}

.btn:not(.secondary):not(.danger):not(.ai):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(8, 145, 178, 0.3);
}

.btn:not(.secondary):not(.danger):not(.ai):active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(8, 145, 178, 0.2);
}

/* Secondary Button */
.btn.secondary {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.btn.secondary:hover {
    background: #f8fafc;
    border-color: rgba(148, 163, 184, 0.4);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* Danger Button */
.btn.danger {
    background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.2);
}

.btn.danger:hover {
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.3);
    transform: translateY(-2px);
}

/* AI Button */
.btn.ai {
    background: linear-gradient(135deg, var(--success) 0%, #047857 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.2);
}

.btn.ai:hover {
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.3);
    transform: translateY(-2px);
}

/* ===== GUNAKAN BUTTON (Use Button) - Cyan/Teal ===== */
.btn-use-result {
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%) !important;
    color: #ffffff !important;
    border: 1px solid rgba(8, 145, 178, 0.3) !important;
    box-shadow: 0 2px 8px rgba(8, 145, 178, 0.25);
    font-weight: 600 !important;
}

.btn-use-result:hover {
    background: linear-gradient(135deg, #0e7490 0%, #155e75 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(8, 145, 178, 0.35);
}

.btn-use-result:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(8, 145, 178, 0.25);
}

/* ===== ABSTRACT BUTTON - Blue/Info ===== */
.btn-show-abstract {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
    color: #ffffff !important;
    border: 1px solid rgba(2, 132, 199, 0.3) !important;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
    font-weight: 600 !important;
}

.btn-show-abstract:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

.btn-show-abstract:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

.btn-show-abstract:disabled,
.btn-show-abstract.muted {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%) !important;
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Small Button */
.btn.small {
    padding: 6px 12px;
    font-size: 0.7rem;
    min-height: 32px;
    letter-spacing: 0.03em;
}

/* Button Icon */
.btn-icon {
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.btn.small .btn-icon {
    font-size: 0.85rem;
    width: 14px;
    height: 14px;
}

/* Citation Actions Override */
.citation-actions .btn {
    padding: 4px 8px !important;
    font-size: 0.65rem !important;
    min-height: 26px !important;
    border-radius: 6px !important;
    font-weight: 500 !important;
    letter-spacing: 0.02em !important;
    text-transform: none !important;
    gap: 4px !important;
}

.citation-actions .btn-icon {
    font-size: 0.75rem !important;
    width: 12px !important;
    height: 12px !important;
}

/* Disabled State */
.btn:disabled,
.btn.muted {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Loading State */
.btn.loading {
    animation: btnPulse 1.5s infinite;
    pointer-events: none;
}

@keyframes btnPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.btn.loading .btn-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Pagination Buttons */
.pagination .btn {
    padding: 10px 18px;
    font-size: 0.78rem;
    min-height: 40px;
}

.pagination .btn:disabled {
    opacity: 0.35;
}

/* Responsive Buttons */
@media (max-width: 768px) {
    .btn {
        padding: 8px 14px;
        font-size: 0.72rem;
        min-height: 36px;
    }

    .btn.small {
        padding: 5px 10px;
        font-size: 0.65rem;
        min-height: 28px;
    }

    .citation-actions .btn {
        padding: 3px 6px !important;
        font-size: 0.6rem !important;
        min-height: 22px !important;
    }
}

/* ===== ERROR BOX ===== */
.error-box {
    background: var(--danger-soft);
    border-radius: var(--radius-md);
    border: 1px solid rgba(220, 38, 38, 0.2);
    padding: 12px 16px;
    font-size: 0.82rem;
    color: var(--danger);
    margin-bottom: 12px;
}

.error-box ul {
    margin-left: 18px;
    margin-top: 6px;
}

/* ===== CITATION LIST ===== */
.citation-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 520px;
    overflow-y: auto;
    padding-right: 8px;
}

/* Custom Scrollbar */
.citation-list::-webkit-scrollbar {
    width: 5px;
}

.citation-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.citation-list::-webkit-scrollbar-thumb {
    background: rgba(8, 145, 178, 0.3);
    border-radius: 3px;
}

.citation-list::-webkit-scrollbar-thumb:hover {
    background: rgba(8, 145, 178, 0.5);
}

.citation-item {
    background: #f8fafc;
    border-radius: var(--radius-md);
    border: 1px solid rgba(226, 232, 240, 0.8);
    padding: 12px 14px;
    font-size: 0.85rem;
    position: relative;
    transition: 
        border-color 0.2s ease,
        background 0.2s ease,
        transform 0.2s ease;
}

.citation-item:hover {
    border-color: rgba(8, 145, 178, 0.3);
    background: #ffffff;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.citation-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.citation-text {
    line-height: 1.5;
    color: var(--text-primary);
}

.citation-actions {
    position: absolute;
    top: 8px;
    right: 10px;
    display: flex;
    gap: 6px;
}

/* ===== CHIP ===== */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: var(--accent-soft);
    font-size: 0.72rem;
    color: var(--accent-primary);
    font-weight: 500;
}

.small-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.muted {
    opacity: 0.6;
}

/* ===== SEARCH AREA ===== */
.search-results {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.search-row {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.search-row input {
    flex: 1;
}

.search-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 6px;
}

.search-limit {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-limit input {
    width: 80px;
    font-size: 0.82rem;
}

/* Search Result Card */
.search-item {
    border-radius: var(--radius-md);
    border: 1px solid rgba(226, 232, 240, 0.8);
    padding: 12px 14px;
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    font-size: 0.82rem;
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    transition: 
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.search-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
    border-color: rgba(8, 145, 178, 0.2);
}

.search-title {
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-size: 0.88rem;
}

.search-meta {
    font-size: 0.76rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.search-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.search-footer span {
    font-size: 0.75rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== DIVIDER ===== */
.divider {
    border: none;
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    margin: 16px 0;
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ===== FOOTER ===== */
.footer {
    margin-top: 28px;
    padding: 16px 0 12px;
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
}

.footer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: var(--accent-tertiary);
    text-decoration: underline;
}

.footer small {
    display: block;
    margin-top: 6px;
    line-height: 1.5;
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== COPY BUTTON ===== */
.copy-btn {
    background: linear-gradient(135deg, var(--success) 0%, #047857 100%);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
    font-weight: 500;
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.25);
}

.copy-btn.copied {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-tertiary) 100%);
}

.copy-btn .icon {
    font-size: 1rem;
}

/* ===== MODAL BACKDROP ===== */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: linear-gradient(165deg, #ffffff 0%, #f8fafc 100%);
    color: var(--text-primary);
    padding: 28px 32px;
    border-radius: var(--radius-xl);
    max-width: 720px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 
        0 0 0 1px rgba(0, 0, 0, 0.03),
        0 25px 60px rgba(0, 0, 0, 0.15);
    animation: modalSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.modal-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

.modal-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.modal-divider {
    margin: 18px 0;
    border: none;
    border-top: 1px solid rgba(226, 232, 240, 0.8);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    line-height: 1.65;
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 0.92rem;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 18px;
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    gap: 12px;
}

/* Close Button */
.close-btn {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
    font-weight: 500;
}

.close-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(71, 85, 105, 0.25);
}

/* ===== TOAST NOTIFICATION ===== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: linear-gradient(135deg, var(--success) 0%, #047857 100%);
    color: white;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateX(400px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10000;
    font-weight: 500;
}

.toast.show {
    transform: translateX(0);
}

.toast .icon {
    font-size: 1.25rem;
}

/* ===== SPINNER ===== */
.spinner {
    border: 2px solid rgba(0, 123, 255, 0.3); /* Lingkaran dasar: biru transparan */
    border-radius: 50%;
    border-top: 2px solid #007BFF; /* Sisi yang berputar: biru solid */
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
}


/* ===== AI BADGE ===== */
.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 4px;
    background: linear-gradient(135deg, var(--success) 0%, #047857 100%);
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== TOOLTIP ===== */
.btn[data-tooltip] {
    position: relative;
}

.btn[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: #ffffff;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: tooltipFadeIn 0.25s ease;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ===== MODAL API KEY OVERRIDES ===== */
#apiKeyModal.modal-backdrop {
    align-items: center;
    justify-content: center;
    padding: 16px;
}

#apiKeyModal .modal-content {
    max-width: 480px !important;
    width: 100% !important;
    border-radius: var(--radius-xl) !important;
    padding: 24px 28px !important;
}

#apiKeyModal .modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
}

#apiKeyModal .modal-title-icon {
    font-size: 1.3rem;
}

#apiKeyModal .modal-title::before {
    content: "";
}

#apiKeyModal .modal-subtitle {
    margin-top: 4px;
    font-size: 0.85rem;
}

#apiKeyModal .modal-body {
    margin-top: 16px;
}

#apiKeyModal .modal-footer {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

#apiKeyModal .modal-input,
#apiKeyInput {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(148, 163, 184, 0.3);
    font-size: 0.9rem;
    font-weight: 500;
    outline: none;
    background: #f8fafc;
    transition: 
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

#apiKeyModal .modal-input:focus,
#apiKeyInput:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

#apiKeyModal .modal-hint {
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ===== JOURNAL INFO & BADGES ===== */
.journal-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
}

.journal-badge {
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    border: 1px solid transparent;
    letter-spacing: 0.02em;
}

.journal-badge.badge-q1 {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #ecfdf5;
    box-shadow: 0 1px 4px rgba(5, 150, 105, 0.2);
}

.journal-badge.badge-q2 {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #eff6ff;
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.2);
}

.journal-badge.badge-q3 {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    color: #fffbeb;
    box-shadow: 0 1px 4px rgba(217, 119, 6, 0.2);
}

.journal-badge.badge-q4 {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: #fef2f2;
    box-shadow: 0 1px 4px rgba(220, 38, 38, 0.2);
}

.journal-badge.badge-gray {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: #f1f5f9;
    box-shadow: 0 1px 4px rgba(100, 116, 139, 0.2);
}

/* ===== API KEY FIELD INLINE ===== */
.api-key-field {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin: 12px 0;
}

.api-key-field label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.api-key-field #apiKeyInput {
    width: 100%;
    padding: 10px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    background: #f8fafc;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: 
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

.api-key-field #apiKeyInput::placeholder {
    color: var(--text-muted);
    opacity: 0.8;
}

.api-key-field #apiKeyInput:focus {
    border-color: var(--accent-primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.08);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

/* Entrance animations for cards */
@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: cardEntrance 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.15s; }
.card:nth-child(3) { animation-delay: 0.25s; }

/* Ripple Effect */
.btn {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: rippleEffect 0.6s ease-out;
    pointer-events: none;
}

@keyframes rippleEffect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Focus visible for accessibility */
.btn:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    body::before {
        display: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-subtle: rgba(148, 163, 184, 0.5);
        --text-secondary: #334155;
        --text-muted: #64748b;
    }
    
    .btn {
        border-width: 2px;
    }
    
    .card {
        border-width: 2px;
    }
}
