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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
}

/* Top Navigation */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    flex-wrap: wrap;
    gap: 8px;
}

.nav-left { display: flex; align-items: center; gap: 16px; }
.nav-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.nav-brand {
    font-size: 1.15em;
    font-weight: 700;
    color: #3b82f6;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-user {
    color: #94a3b8;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.88em;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-link:hover { background: #334155; color: #e2e8f0; }
.nav-logout:hover { color: #ef4444; }

/* Badges */
.badge {
    font-size: 0.75em;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.badge-admin { background: #3b82f6; color: white; }
.badge-free { background: #64748b; color: white; }

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Tabs */
.nav-tabs, .admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 24px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #94a3b8;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tab-btn:hover { background: #334155; color: #e2e8f0; }
.tab-btn.active { background: #3b82f6; color: white; border-color: #3b82f6; }
.tab-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Admin Panels */
.admin-panel { display: none; }
.admin-panel.active { display: block; }

.admin-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.admin-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-card-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.15em;
}

/* Form elements */
.form-group { margin-bottom: 14px; }

.form-group label {
    display: block;
    font-size: 0.88em;
    color: #94a3b8;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 10px 14px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.95em;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus, .form-group select:focus { border-color: #3b82f6; }

.form-input {
    padding: 8px 12px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 0.9em;
    outline: none;
}

.form-input:focus { border-color: #3b82f6; }

.form-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.form-message {
    font-size: 0.88em;
    margin-bottom: 10px;
    display: none;
}

.add-form {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.add-form h4 { margin-bottom: 10px; font-size: 0.95em; color: #94a3b8; }

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary { background: #3b82f6; color: white; }
.btn-primary:hover { background: #2563eb; }
.btn-secondary { background: #334155; color: #e2e8f0; }
.btn-secondary:hover { background: #475569; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: #16a34a; color: white; }
.btn-success:hover { background: #15803d; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 14px; font-size: 0.82em; }
.btn-xs { padding: 4px 10px; font-size: 0.75em; border-radius: 4px; }

/* Tables */
.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88em;
}

.data-table th {
    text-align: left;
    padding: 10px 12px;
    background: #0f172a;
    color: #94a3b8;
    font-weight: 600;
    border-bottom: 1px solid #334155;
    white-space: nowrap;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #1e293b;
}

.data-table tr:hover td { background: rgba(59, 130, 246, 0.05); }

.action-cell {
    white-space: nowrap;
    display: flex;
    gap: 4px;
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #334155;
}

.ticker {
    font-weight: 700;
    font-size: 1.1em;
    color: #f1f5f9;
}

.price {
    font-size: 1.3em;
    font-weight: 700;
    color: #3b82f6;
}

.card-body { display: flex; flex-direction: column; gap: 8px; }

.stat {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
}

.stat .label { color: #64748b; }

.change { font-weight: 600; }
.change.green { color: #22c55e; }
.change.red { color: #ef4444; }

/* Settings */
.settings-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .settings-container { grid-template-columns: 1fr; }
}

.settings-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 24px;
}

.settings-card h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 1.1em;
}

.settings-card h3 .badge-count {
    margin-left: auto;
}

.settings-desc {
    color: #64748b;
    font-size: 0.85em;
    margin-bottom: 16px;
}

.ticker-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ticker-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9em;
    font-weight: 600;
    color: #94a3b8;
}

.ticker-checkbox:hover { border-color: #3b82f6; }
.ticker-checkbox.checked { border-color: #3b82f6; color: #3b82f6; background: rgba(59, 130, 246, 0.08); }

.ticker-checkbox input { display: none; }

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid #475569;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ticker-checkbox.checked .checkmark {
    background: #3b82f6;
    border-color: #3b82f6;
}

.ticker-checkbox.checked .checkmark::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 10px;
    color: white;
}

/* Login Page */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #0f172a;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 16px;
    padding: 40px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-icon {
    font-size: 2.5em;
    color: #3b82f6;
    margin-bottom: 12px;
}

.login-header h1 {
    font-size: 1.6em;
    color: #f1f5f9;
    margin-bottom: 6px;
}

.login-header p { color: #64748b; font-size: 0.9em; }

.login-form .form-group { margin-bottom: 18px; }

.login-form .form-group label {
    font-size: 0.85em;
    color: #94a3b8;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.login-form .form-group input {
    width: 100%;
    padding: 12px 16px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 0.95em;
    outline: none;
    transition: border-color 0.2s;
}

.login-form .form-group input:focus { border-color: #3b82f6; }

/* Alert */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.88em;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 16px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 1.5em;
    cursor: pointer;
    color: #64748b;
    transition: color 0.2s;
}

.modal-close:hover { color: #ef4444; }

.modal-content h3 {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Update result */
.update-result {
    margin-top: 16px;
    padding: 16px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
}

.update-result h4 { margin-bottom: 8px; color: #3b82f6; }
.update-result p { margin-bottom: 4px; font-size: 0.9em; color: #94a3b8; }

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: #64748b;
    font-size: 0.85em;
}

@media (max-width: 640px) {
    .grid { grid-template-columns: 1fr; }
    .nav-tabs, .admin-tabs { flex-wrap: wrap; }
    .top-nav { flex-direction: column; align-items: stretch; text-align: center; }
    .nav-right { justify-content: center; }
    .admin-card-header { flex-direction: column; }
}

/* Search Box */
.ticker-search-box {
    position: relative;
    margin-bottom: 16px;
}

.ticker-search-box .form-input {
    width: 100%;
    padding: 12px 16px;
    padding-left: 40px;
    background: #0f172a;
    border: 1px solid #2a3a4e;
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 0.9em;
    outline: none;
    transition: border-color 0.2s;
}

.ticker-search-box .form-input:focus { border-color: #3b82f6; }

.ticker-search-box::before {
    content: '\f002';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #475569;
    font-size: 0.85em;
    pointer-events: none;
}

.search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1e293b;
    border: 1px solid #3b82f6;
    border-radius: 12px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
    margin-top: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 0.88em;
    color: #e2e8f0;
    transition: background 0.15s;
    border-bottom: 1px solid #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-result-item:last-child { border-bottom: none; border-radius: 0 0 12px 12px; }
.search-result-item:first-child { border-radius: 12px 12px 0 0; }
.search-result-item:hover { background: rgba(59,130,246,0.1); }
.search-result-item.disabled { color: #64748b; cursor: default; }

/* Sortable Ticker List */
.ticker-sortable-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 40px;
}

.ticker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #0f172a 0%, #1a2332 100%);
    border: 1px solid #2a3a4e;
    border-radius: 12px;
    transition: all 0.25s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.ticker-item:hover {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #0f172a 0%, #1a2740 100%);
    box-shadow: 0 2px 12px rgba(59,130,246,0.12);
    transform: translateY(-1px);
}

.ticker-item-grip {
    color: #475569;
    font-size: 0.85em;
    cursor: grab;
    padding: 4px;
    opacity: 0.5;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.ticker-item:hover .ticker-item-grip { opacity: 1; }

.ticker-item-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.ticker-item-code {
    font-weight: 700;
    font-size: 0.95em;
    color: #f1f5f9;
    letter-spacing: 0.03em;
}

.ticker-item-sub {
    font-size: 0.75em;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
    line-height: 1.3;
}

.ticker-item-actions {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.ticker-item-actions .btn-move,
.ticker-item-actions .btn-remove {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 0.8em;
}

.ticker-item-actions .btn-move {
    border-color: #2a3a4e;
    background: rgba(30,41,59,0.5);
}

.ticker-item-actions .btn-move:hover {
    border-color: #3b82f6;
    background: rgba(59,130,246,0.12);
    color: #3b82f6;
    box-shadow: 0 0 8px rgba(59,130,246,0.15);
}

.ticker-item-actions .btn-remove {
    margin-left: 6px;
    border-color: #2a3a4e;
    background: rgba(30,41,59,0.5);
}

.ticker-item-actions .btn-remove:hover {
    border-color: #ef4444;
    background: rgba(239,68,68,0.12);
    color: #ef4444;
    box-shadow: 0 0 8px rgba(239,68,68,0.15);
}

.btn-icon {
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    background: transparent;
    color: #64748b;
}

.btn-outline {
    background: transparent;
    border: 1px solid #334155;
    color: #94a3b8;
}

.btn-outline:hover { border-color: #3b82f6; color: #3b82f6; }

/* Request badge */
.badge-danger { background: #dc2626; color: white; }
.badge-saham { background: #3b82f6; color: white; }
.badge-crypto { background: #f59e0b; color: white; }
.badge-count {
    background: #1e293b;
    color: #94a3b8;
    font-size: 0.7em;
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 600;
    border: 1px solid #334155;
}

/* Card company name */
.stat .company-name {
    font-size: 0.8em;
    color: #64748b;
    margin-top: -4px;
    margin-bottom: 4px;
}
