/* global.css — Bobtail Group Internal App Design System */

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

/* ─── Design Tokens ────────────────────────────────────────────────────────── */
:root {
    --color-bg:           #f8fafc;
    --color-surface:      #ffffff;
    --color-primary:      #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-success:      #059669;
    --color-success-dark: #047857;
    --color-danger:       #dc2626;
    --color-danger-dark:  #b91c1c;
    --color-warning:      #d97706;
    --color-text:         #0f172a;
    --color-text-muted:   #64748b;
    --color-border:       #e2e8f0;
    --color-border-focus: #2563eb;

    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.09), 0 3px 8px rgba(0, 0, 0, 0.06);

    --nav-height:    64px;
    --sidebar-width: 220px;

    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
}

/* ─── Bottom Navigation Bar (Mobile) ────────────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--nav-height);
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: stretch;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
    padding-bottom: env(safe-area-inset-bottom);
}

/* Logo link — hidden on mobile */
.bottom-nav .nav-logo {
    display: none;
}

.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: color var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    padding: 8px 4px;
    min-width: 0;
    position: relative;
}

.bottom-nav a svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.bottom-nav a.active {
    color: var(--color-primary);
}

.bottom-nav a.active svg {
    transform: scale(1.1);
}

.bottom-nav a.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--color-primary);
    border-radius: 0 0 2px 2px;
}

.bottom-nav a:active {
    background: var(--color-bg);
}

.bottom-nav a span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1;
}

/* Body padding for mobile nav */
body.has-nav {
    padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
}

/* ─── Desktop: Left Sidebar ───────────────────────────────────────────────── */
@media (min-width: 768px) {
    .bottom-nav {
        top: 0;
        bottom: 0;
        left: 0;
        right: auto;
        width: var(--sidebar-width);
        height: 100dvh;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        border-top: none;
        border-right: 1px solid var(--color-border);
        box-shadow: 2px 0 16px rgba(0, 0, 0, 0.04);
        padding-bottom: 0;
        overflow-y: auto;
    }

    /* Logo area at top of sidebar */
    .bottom-nav .nav-logo {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 20px 20px 18px;
        border-bottom: 1px solid var(--color-border);
        margin-bottom: 8px;
        text-decoration: none;
        color: var(--color-text);
        flex: none;
    }

    .bottom-nav .nav-logo img {
        width: 36px;
        height: 36px;
        border-radius: var(--radius-sm);
        object-fit: contain;
        flex-shrink: 0;
    }

    .bottom-nav .nav-logo span {
        font-size: 13px;
        font-weight: 700;
        color: var(--color-text);
        white-space: nowrap;
        overflow: visible;
        text-overflow: unset;
        line-height: 1.2;
        letter-spacing: -0.2px;
    }

    /* Nav items: horizontal row layout */
    .bottom-nav a:not(.nav-logo) {
        flex-direction: row;
        justify-content: flex-start;
        padding: 11px 16px;
        gap: 12px;
        font-size: 14px;
        font-weight: 500;
        border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
        margin: 2px 12px 2px 0;
        flex: none;
        letter-spacing: 0;
    }

    .bottom-nav a:not(.nav-logo) svg {
        width: 18px;
        height: 18px;
    }

    /* Active: left border indicator + subtle blue bg */
    .bottom-nav a.active::after {
        top: 0;
        bottom: 0;
        left: 0;
        right: auto;
        width: 3px;
        height: auto;
        border-radius: 0 2px 2px 0;
    }

    .bottom-nav a.active {
        background: #eff6ff;
        color: var(--color-primary);
    }

    .bottom-nav a:not(.nav-logo):hover:not(.active) {
        background: var(--color-bg);
        color: var(--color-text);
    }

    /* Body: left padding instead of bottom padding */
    body.has-nav {
        padding-bottom: 0;
        padding-left: var(--sidebar-width);
    }

    /* Hide redundant page-level logo when sidebar shows one */
    body.has-nav > a:has(> .logo),
    body.has-nav > a:has(> img.logo) {
        display: none;
    }

    /* Breathing room at top of content */
    body.has-nav .container {
        margin-top: 32px;
    }
}

/* ─── Global component overrides ─────────────────────────────────────────── */

.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-header h1 {
    flex: 1;
    margin: 0;
    text-align: left;
    font-size: 20px;
}

/* ─── Badge ──────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

/* ─── Skeleton loading pulse ─────────────────────────────────────────────── */
@keyframes skeleton-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.skeleton {
    background: var(--color-border);
    border-radius: var(--radius-sm);
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}
