/* ========================================
   link.kgoker.info — Koyu Tema
   ======================================== */

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --bg-input: #0f172a;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #38bdf8;
    --accent-hover: #0ea5e9;
    --accent-dim: rgba(56,189,248,0.15);
    --danger: #f87171;
    --danger-hover: #ef4444;
    --success: #4ade80;
    --warning: #fbbf24;
    --border: #334155;
    --border-focus: #38bdf8;
    --sidebar-width: 260px;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
    --transition: 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ========================================
   Layout
   ======================================== */

.app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-icon { font-size: 1.4rem; }
.brand-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.02em;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
}
.sidebar-toggle:hover { color: var(--text-primary); background: var(--bg-hover); }

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
}

.nav-list {
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.7rem 1.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition);
    border-left: 3px solid transparent;
    flex-wrap: wrap;
}
.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.nav-item.active {
    color: var(--accent);
    background: var(--accent-dim);
    border-left-color: var(--accent);
}

.nav-icon { font-size: 1.15rem; flex-shrink: 0; }
.nav-label { font-size: 0.95rem; font-weight: 500; }

.nav-subitems {
    list-style: none;
    width: 100%;
    padding-left: 2.2rem;
    margin-top: 0.25rem;
}

.nav-subitem {
    padding: 0.35rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.nav-subitem:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-subitem.active { color: var(--accent); }
.sub-icon { font-size: 0.85rem; }

/* Not alt başlıkları */
.note-title-item {
    padding: 0.3rem 0.75rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
}
.note-title-item:hover { color: var(--text-primary); background: var(--bg-hover); }
.note-title-item.active { color: var(--accent); }

/* Content */
.content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
}

.content-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem;
}

/* ========================================
   Section Header
   ======================================== */

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    line-height: 1.4;
    font-family: inherit;
}
.btn-primary {
    background: var(--accent);
    color: #0f172a;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.3rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: all var(--transition);
}
.btn-icon:hover { color: var(--text-primary); background: var(--bg-hover); }
.btn-icon.danger:hover { color: var(--danger); }

/* ========================================
   Cards
   ======================================== */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem;
    transition: all var(--transition);
}
.card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
}
.card-title a { color: var(--accent); }
.card-title a:hover { text-decoration: underline; }

.card-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.card-url {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', monospace;
    word-break: break-all;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    font-size: 0.75rem;
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 999px;
}

/* ========================================
   Forms
   ======================================== */

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 0.6rem 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color var(--transition);
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

/* ========================================
   Note Editor
   ======================================== */

.note-editor {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 4rem);
}

.note-title-input {
    width: 100%;
    padding: 0.5rem 0;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--border);
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    font-family: inherit;
    margin-bottom: 0.5rem;
    transition: border-color var(--transition);
}
.note-title-input:focus {
    outline: none;
    border-bottom-color: var(--accent);
}

.note-content-input {
    flex: 1;
    width: 100%;
    padding: 0.75rem 0;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.7;
    resize: none;
}
.note-content-input:focus { outline: none; }

.note-save-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.2rem 0;
    transition: color var(--transition);
}
.note-save-status.saving { color: var(--warning); }
.note-save-status.saved { color: var(--success); }
.note-save-status.error { color: var(--danger); }

.note-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
}

/* ========================================
   Contact Card
   ======================================== */

.contact-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
}

.contact-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-dim);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.contact-info { flex: 1; min-width: 0; }
.contact-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}
.contact-detail {
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.contact-detail a { color: var(--text-secondary); }
.contact-detail a:hover { color: var(--accent); }

.favorite-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.3rem;
    transition: transform var(--transition);
    color: var(--text-muted);
}
.favorite-btn:hover { transform: scale(1.2); }
.favorite-btn.active { color: var(--warning); }

/* ========================================
   Contact List
   ======================================== */

.contact-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ========================================
   Modal
   ======================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 500;
}
.modal-overlay.open { display: flex; }

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1.1rem; font-weight: 600; }
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-hover); }

.modal-body { padding: 1.25rem; }

/* ========================================
   Toast
   ======================================== */

.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: #fff;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
    max-width: 350px;
}
.toast.success { background: #16a34a; }
.toast.error   { background: #dc2626; }
.toast.info    { background: #2563eb; }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut  { from { opacity: 1; } to { opacity: 0; } }

/* ========================================
   Empty State
   ======================================== */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state-text { font-size: 1rem; margin-bottom: 0.5rem; }
.empty-state-hint { font-size: 0.85rem; color: var(--text-muted); }

/* ========================================
   Import Area
   ======================================== */

.import-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 1.5rem;
}
.import-area:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
}

/* ========================================
   Mobile Responsive
   ======================================== */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: block; }

    .content {
        margin-left: 0;
    }
    .content-inner {
        padding: 1rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .section-header {
        margin-bottom: 1rem;
    }
    .section-title { font-size: 1.25rem; }

    /* Mobile overlay */
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
        display: none;
    }
    .sidebar-backdrop.open { display: block; }
}

/* ========================================
   Category Filter Tabs
   ======================================== */

.tab-bar {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.tab-item {
    padding: 0.35rem 0.85rem;
    font-size: 0.82rem;
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: all var(--transition);
}
.tab-item:hover { color: var(--text-primary); border-color: var(--accent); }
.tab-item.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: var(--accent);
}

/* ========================================
   Scrollbar
   ======================================== */

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ========================================
   Loading
   ======================================== */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
}
.spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 0.75rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========================================
   Login Page
   ======================================== */

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    background: var(--bg-primary);
}

.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow);
}

.login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.login-error {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    text-align: center;
}

.btn-login {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    margin-top: 0.5rem;
}

/* ========================================
   Sidebar Footer (user + logout)
   ======================================== */

.sidebar-footer {
    margin-top: auto;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.btn-logout {
    font-size: 0.78rem;
    padding: 0.3rem 0.6rem;
}