@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    /* Light Theme */
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --text-main: #111827;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: rgba(37, 99, 235, 0.1);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] {
    /* Dark Theme (Modern Grey) */
    --bg-body: #0f1115; /* Çok koyu gri, neredeyse siyah */
    --bg-card: #181b21; /* Koyu gri kartlar */
    --bg-sidebar: #181b21;
    --text-main: #f9fafb;
    --text-secondary: #9ca3af;
    --border: #2d3139;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-light: rgba(59, 130, 246, 0.15);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; outline: none; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

/* --- LOGIN SCREEN --- */
#login-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-body);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    background: var(--bg-card);
    border-radius: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    text-align: center;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    margin-bottom: 24px;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.3);
}

.login-title { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.login-desc { color: var(--text-secondary); font-size: 14px; margin-bottom: 32px; }

.key-input-group {
    position: relative;
    margin-bottom: 24px;
}

.key-input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    background: var(--bg-body);
    border: 2px solid var(--border);
    border-radius: 16px;
    color: var(--text-main);
    font-size: 16px;
    font-family: monospace;
    letter-spacing: 2px;
    transition: all 0.3s;
}

.key-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-light); }
.key-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-secondary); }

.btn-login {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 16px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-login:hover { background: var(--primary-hover); transform: translateY(-2px); }

/* --- DASHBOARD LAYOUT --- */
#app-screen { display: flex; height: 100vh; }

.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    transition: transform 0.3s ease;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    padding: 0 12px;
}
.brand-icon {
    width: 32px; height: 32px;
    background: var(--primary);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: white;
}
.brand-text { font-size: 18px; font-weight: 700; letter-spacing: -0.5px; }

.nav-menu { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
}
.nav-link:hover { background: var(--bg-body); color: var(--text-main); }
.nav-link.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

.user-area {
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
}
.avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--bg-body);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.main-content {
    flex: 1;
    display: flex; flex-direction: column;
    overflow: hidden;
    position: relative;
}

.top-bar {
    height: 80px;
    padding: 0 32px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}

.page-header h1 { font-size: 20px; font-weight: 700; }
.page-header p { font-size: 13px; color: var(--text-secondary); }

.actions { display: flex; gap: 16px; }

.btn-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-body);
    color: var(--text-main);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-icon:hover { border-color: var(--primary); color: var(--primary); }

.btn-primary {
    padding: 0 20px;
    height: 40px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    transition: all 0.2s;
}
.btn-primary:hover { background: var(--primary-hover); }

.content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

/* --- COMPONENTS --- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border);
    display: flex; align-items: center; gap: 20px;
}
.stat-icon {
    width: 56px; height: 56px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
}

.table-card {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
}
.table-head {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.table-title { font-weight: 700; font-size: 16px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 16px 24px; font-size: 12px; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; background: var(--bg-body); }
td { padding: 16px 24px; border-bottom: 1px solid var(--border); font-size: 14px; }
tr:last-child td { border-bottom: none; }

.badge { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-active { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-passive { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

/* --- WIZARD MODAL --- */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: none;
    align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.3s;
}
.modal-backdrop.show { display: flex; opacity: 1; }

.modal-content {
    background: var(--bg-card);
    width: 90%; max-width: 800px;
    border-radius: 24px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    display: flex; flex-direction: column;
    max-height: 90vh;
}

.modal-header { padding: 24px 32px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 32px; overflow-y: auto; }
.modal-footer { padding: 24px 32px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; }

.wizard-steps { display: flex; justify-content: space-between; margin-bottom: 40px; position: relative; }
.wizard-steps::after { content:''; position: absolute; top: 15px; left: 0; right: 0; height: 2px; background: var(--border); z-index: 0; }
.step { position: relative; z-index: 1; background: var(--bg-card); padding: 0 10px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.step-num { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-body); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; color: var(--text-secondary); transition: all 0.3s; }
.step.active .step-num { border-color: var(--primary); background: var(--primary); color: white; box-shadow: 0 0 0 4px var(--primary-light); }
.step.done .step-num { border-color: var(--success); background: var(--success); color: white; }
.step-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.step.active .step-title { color: var(--primary); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { margin-bottom: 20px; }
.form-label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.form-input { width: 100%; padding: 12px 16px; background: var(--bg-body); border: 2px solid var(--border); border-radius: 12px; color: var(--text-main); transition: all 0.2s; }
.form-input:focus { border-color: var(--primary); background: var(--bg-card); }

.template-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.template-item { border: 2px solid var(--border); border-radius: 16px; padding: 20px; text-align: center; cursor: pointer; transition: all 0.2s; }
.template-item:hover { border-color: var(--primary); background: var(--bg-body); }
.template-item.selected { border-color: var(--primary); background: var(--primary-light); }

/* Toast */
.toast-wrap { position: fixed; top: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--bg-card); padding: 16px 20px; border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px; animation: slideIn 0.3s; min-width: 300px; }
.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

@media (max-width: 768px) {
    .sidebar { position: fixed; transform: translateX(-100%); z-index: 50; height: 100%; }
    .sidebar.open { transform: translateX(0); }
    .form-grid { grid-template-columns: 1fr; }
}
