/* ==============================
   Partner Portal — Dark Theme CSS
   ============================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #1c2128;
    --bg-card: #21262d;
    --border: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent-blue: #1f6feb;
    --accent-blue-hover: #388bfd;
    --accent-green: #238636;
    --accent-green-soft: #2ea04326;
    --accent-yellow: #d29922;
    --accent-red: #da3633;
    --accent-purple: #8b5cf6;
    --sidebar-width: 240px;
    --topbar-height: 60px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
}

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

.sidebar-brand {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand img { height: 32px; }

.sidebar-brand-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}
.sidebar-brand-text span {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
}

.sidebar-section-label {
    padding: 16px 20px 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.sidebar-nav { flex: 1; padding: 8px 0; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-nav a.active {
    background: rgba(31, 111, 235, 0.12);
    color: var(--accent-blue-hover);
    border-left-color: var(--accent-blue);
}

.sidebar-nav a svg, .sidebar-nav a i {
    width: 18px;
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-footer .avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--accent-blue);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    color: #fff; flex-shrink: 0;
}

.sidebar-footer .user-info { flex: 1; min-width: 0; }
.sidebar-footer .user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer .user-role { font-size: 11px; color: var(--text-muted); }

/* ======= TOPBAR ======= */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 900;
}

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

.topbar-title { font-size: 16px; font-weight: 600; }

.breadcrumb-bar {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}
.breadcrumb-bar a { color: var(--text-secondary); text-decoration: none; }
.breadcrumb-bar a:hover { color: var(--accent-blue-hover); }

/* ======= MAIN CONTENT ======= */
.main-content {
    margin-left: var(--sidebar-width);
    padding-top: var(--topbar-height);
    min-height: 100vh;
}

.page-body {
    padding: 28px;
}

/* ======= CARDS ======= */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ======= STAT CARDS ======= */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon.blue { background: rgba(31,111,235,0.15); color: var(--accent-blue-hover); }
.stat-icon.green { background: rgba(35,134,54,0.15); color: #3fb950; }
.stat-icon.yellow { background: rgba(210,153,34,0.15); color: var(--accent-yellow); }
.stat-icon.purple { background: rgba(139,92,246,0.15); color: var(--accent-purple); }
.stat-icon.red { background: rgba(218,54,51,0.15); color: #f85149; }

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ======= TABLE ======= */
.table-wrapper {
    overflow-x: auto;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
}

table.data-table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    color: var(--text-secondary);
    vertical-align: middle;
}

table.data-table tr:last-child td { border-bottom: none; }

table.data-table tr:hover td {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ======= BADGES ======= */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-registered { background: rgba(139,92,246,0.15); color: var(--accent-purple); }
.badge-contacted { background: rgba(31,111,235,0.15); color: var(--accent-blue-hover); }
.badge-presented { background: rgba(210,153,34,0.15); color: var(--accent-yellow); }
.badge-negotiating { background: rgba(210,153,34,0.2); color: #e3b341; }
.badge-won { background: rgba(35,134,54,0.15); color: #3fb950; }
.badge-lost { background: rgba(218,54,51,0.15); color: #f85149; }
.badge-active { background: rgba(35,134,54,0.15); color: #3fb950; }
.badge-inactive { background: rgba(110,118,129,0.15); color: var(--text-muted); }

/* ======= BUTTONS ======= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent-blue);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-blue-hover); color: #fff; }

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-card); color: var(--text-primary); }

.btn-danger {
    background: rgba(218,54,51,0.15);
    color: #f85149;
    border: 1px solid rgba(218,54,51,0.3);
}
.btn-danger:hover { background: rgba(218,54,51,0.25); }

.btn-success {
    background: var(--accent-green);
    color: #fff;
}
.btn-success:hover { background: #2ea043; color: #fff; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ======= FORMS ======= */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(31,111,235,0.15);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control option { background: var(--bg-tertiary); }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.validation-message {
    font-size: 12px;
    color: #f85149;
    margin-top: 4px;
}

/* ======= ALERTS ======= */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-success {
    background: rgba(35,134,54,0.15);
    border: 1px solid rgba(35,134,54,0.3);
    color: #3fb950;
}

.alert-danger {
    background: rgba(218,54,51,0.15);
    border: 1px solid rgba(218,54,51,0.3);
    color: #f85149;
}

/* ======= PAGE HEADER ======= */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.page-header p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ======= TIMELINE ======= */
.timeline { padding-left: 0; list-style: none; }
.timeline-item {
    display: flex;
    gap: 14px;
    padding-bottom: 20px;
    position: relative;
}
.timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 17px; top: 34px;
    width: 2px;
    bottom: 0;
    background: var(--border);
}
.timeline-dot {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    z-index: 1;
}
.timeline-body { flex: 1; }
.timeline-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.timeline-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ======= SIMULATOR ======= */
.sim-result {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
}

.sim-bar {
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-primary);
    display: flex;
    margin: 8px 0;
}
.sim-bar-owner { background: var(--accent-blue-hover); }
.sim-bar-seller { background: #3fb950; }
.sim-bar-platform { background: var(--accent-purple); }

.sim-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.sim-row:last-child { border-bottom: none; }

/* ======= RESPONSIVE ======= */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; }
    .topbar { left: 0; }
    .form-grid { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
}

/* ======= SCROLLBAR ======= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
