/* ═══════════════════════════════════════════════════════════════════════════
   RLiT — Red Leaf Integration Tools
   Main Stylesheet
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    /* Palette */
    --bg-base:        #0d0f12;
    --bg-surface:     #141619;
    --bg-elevated:    #1c1f24;
    --bg-hover:       #22262d;

    --border:         rgba(255,255,255,0.07);
    --border-active:  rgba(255,255,255,0.14);

    --text-primary:   #f0f2f5;
    --text-secondary: #8a909c;
    --text-muted:     #4e5562;

    --accent:         #c8f045;      /* Red Leaf green-yellow */
    --accent-dim:     rgba(200,240,69,0.12);
    --accent-hover:   #d4f55c;

    --red:            #ff4d4d;
    --blue:           #4d9fff;

    /* Geometry */
    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  14px;

    /* Sidebar */
    --sidebar-w:  230px;

    /* Type */
    --font-sans: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'DM Mono', 'Menlo', monospace;
}

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

html { font-size: 15px; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font-sans);
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
code { font-family: var(--font-mono); }

/* ── App Shell ───────────────────────────────────────────────────────────── */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-mark {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0d0f12;
    flex-shrink: 0;
}

.logo-mark.large {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
}

.logo-mark svg {
    width: 18px;
    height: 18px;
}

.logo-mark.large svg {
    width: 24px;
    height: 24px;
}

.logo-text { display: flex; flex-direction: column; }
.logo-name  { font-weight: 600; font-size: 0.95rem; letter-spacing: 0.02em; }
.logo-sub   { font-size: 0.67rem; color: var(--text-muted); letter-spacing: 0.03em; }

/* Nav */
.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.nav-section { display: flex; flex-direction: column; gap: 2px; }

.nav-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 8px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
}

.nav-item svg, .nav-item .nav-icon { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item .nav-icon svg            { width: 16px; height: 16px; }

.nav-item:hover  { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }

.nav-badge {
    margin-left: auto;
    font-size: 0.6rem;
    font-weight: 600;
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 20px;
    padding: 2px 6px;
    letter-spacing: 0.04em;
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

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

.user-details { display: flex; flex-direction: column; min-width: 0; }
.user-name    { font-size: 0.78rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email   { font-size: 0.65rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.logout-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.logout-btn:hover { background: var(--bg-hover); color: var(--red); }
.logout-btn svg   { width: 15px; height: 15px; }

/* ── Main Content ────────────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 0 32px 48px;
}

/* ── Page Header ─────────────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 28px 0 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
}

.page-title    { font-size: 1.4rem; font-weight: 600; letter-spacing: -0.01em; }
.page-subtitle { font-size: 0.875rem; color: var(--text-secondary); margin-top: 2px; }

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.breadcrumb a:hover { color: var(--text-secondary); }
.breadcrumb span:last-child { color: var(--text-secondary); }

.status-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 5px 12px;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(74,222,128,0.6);
}

/* ── Section ─────────────────────────────────────────────────────────────── */
.section-title {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* ── Tool Grid ───────────────────────────────────────────────────────────── */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.tool-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
    cursor: pointer;
}

.tool-card:hover {
    border-color: var(--border-active);
    background: var(--bg-elevated);
    transform: translateY(-2px);
}

.tool-card-icon {
    width: 36px;
    height: 36px;
    background: var(--accent-dim);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}
.tool-card-icon svg { width: 18px; height: 18px; }

.tool-card-name { font-size: 0.95rem; font-weight: 600; }
.tool-card-desc { font-size: 0.82rem; color: var(--text-secondary); margin-top: 2px; line-height: 1.5; }

.tool-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.tool-badge {
    font-size: 0.65rem;
    font-weight: 600;
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 20px;
    padding: 2px 8px;
    letter-spacing: 0.04em;
}

.tool-arrow {
    color: var(--text-muted);
    font-size: 1rem;
    transition: color 0.2s, transform 0.2s;
}

.tool-card:hover .tool-arrow {
    color: var(--accent);
    transform: translateX(3px);
}

/* ── Empty State ─────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    width: 56px;
    height: 56px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: var(--text-muted);
}
.empty-icon svg { width: 28px; height: 28px; }
.empty-state h3 { font-size: 1rem; font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }
.empty-state p  { font-size: 0.875rem; color: var(--text-secondary); }
.empty-state code {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.82rem;
    color: var(--accent);
}

/* ── Login Page ──────────────────────────────────────────────────────────── */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-base);
    background-image:
        radial-gradient(ellipse 60% 50% at 50% 0%, rgba(200,240,69,0.06) 0%, transparent 70%);
}

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

.login-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 4px;
}

.login-title    { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; }
.login-subtitle { font-size: 0.78rem; color: var(--text-muted); margin-top: 1px; }

.login-prompt {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.ms-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 11px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-active);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: background 0.2s, border-color 0.2s;
    cursor: pointer;
}
.ms-login-btn:hover { background: var(--bg-hover); border-color: rgba(255,255,255,0.2); }
.ms-login-btn svg   { width: 20px; height: 20px; flex-shrink: 0; }

.login-footer {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    line-height: 1.5;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-error {
    background: rgba(255,77,77,0.1);
    border: 1px solid rgba(255,77,77,0.25);
    color: #ff9999;
}

/* ── Utility ─────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font-sans);
    border: none;
    cursor: pointer;
    transition: opacity 0.15s, filter 0.15s;
    text-decoration: none;
}
.btn:hover { filter: brightness(1.1); }

.btn-primary {
    background: var(--accent);
    color: #0d0f12;
}
.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-active);
}

/* Form elements */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); }
.form-input, .form-select, .form-textarea {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    padding: 8px 12px;
    transition: border-color 0.15s;
    outline: none;
    width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--accent);
}
.form-textarea { resize: vertical; min-height: 100px; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th {
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-active); border-radius: 3px; }
