/* ==========================================================================
   CollarID — Shared Styles
   Dark-first theming with CSS custom properties for future light mode toggle.
   Used alongside Tailwind CDN across all CollarID pages.
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. Font Imports
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');


/* --------------------------------------------------------------------------
   2. CSS Custom Properties — Dark Theme (default)
   -------------------------------------------------------------------------- */
:root {
    --bg-primary:   #0a0a0a;
    --bg-secondary: #111;
    --bg-card:      rgba(255,255,255,0.03);

    --text-primary:   #e5e5e5;
    --text-secondary: #9ca3af;
    --text-muted:     #6b7280;

    --border:       rgba(255,255,255,0.08);
    --border-light: rgba(255,255,255,0.12);

    --blue:   #60a5fa;
    --purple: #a78bfa;
    --pink:   #f472b6;
    --green:  #10b981;
    --amber:  #f59e0b;
    --red:    #ef4444;
}


/* --------------------------------------------------------------------------
   3. CSS Custom Properties — Light Theme
   -------------------------------------------------------------------------- */
html.light {
    --bg-primary:   #f8fafc;
    --bg-secondary: #fff;
    --bg-card:      rgba(0,0,0,0.02);

    --text-primary:   #1e293b;
    --text-secondary: #64748b;
    --text-muted:     #94a3b8;

    --border:       rgba(0,0,0,0.08);
    --border-light: rgba(0,0,0,0.12);

    --blue:   #3b82f6;
    --purple: #7c3aed;
    --pink:   #ec4899;
    --green:  #059669;
    --amber:  #d97706;
    --red:    #dc2626;
}


/* --------------------------------------------------------------------------
   4. Base Reset & Body
   -------------------------------------------------------------------------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
}


/* --------------------------------------------------------------------------
   5. Glass Effects
   -------------------------------------------------------------------------- */
.glass {
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
}

html.light .glass {
    background: rgba(255,255,255,0.7);
    border-color: rgba(0,0,0,0.08);
}

.glass-strong {
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255,255,255,0.15);
}

html.light .glass-strong {
    background: rgba(255,255,255,0.85);
    border-color: rgba(0,0,0,0.12);
}

.glass-nav {
    background: rgba(10,10,15,0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

html.light .glass-nav {
    background: rgba(255,255,255,0.92);
}


/* --------------------------------------------------------------------------
   6. Status Dots
   -------------------------------------------------------------------------- */
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.dot-live {
    background: var(--green);
    animation: pulse 2s infinite;
}

.dot-poll {
    background: var(--blue);
}

.dot-off {
    background: var(--text-muted);
}


/* --------------------------------------------------------------------------
   7. Data Tables
   -------------------------------------------------------------------------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table th {
    position: sticky;
    top: 0;
    background: rgba(15,15,20,0.98);
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.05em;
    padding: 7px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

html.light .data-table th {
    background: rgba(248,250,252,0.98);
}

.data-table td {
    padding: 5px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-family: 'JetBrains Mono', monospace;
    color: #d1d5db;
    white-space: nowrap;
}

html.light .data-table td {
    border-bottom-color: rgba(0,0,0,0.04);
    color: var(--text-secondary);
}

.data-table tr:hover td {
    background: rgba(255,255,255,0.03);
}

html.light .data-table tr:hover td {
    background: rgba(0,0,0,0.02);
}

.table-wrap {
    max-height: 420px;
    overflow-y: auto;
    border-radius: 10px;
    border: 1px solid var(--border);
}


/* --------------------------------------------------------------------------
   8. Buttons
   -------------------------------------------------------------------------- */
.btn {
    padding: 7px 16px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
    border: 1px solid;
    font-family: 'Inter', sans-serif;
}

.btn-blue {
    background: rgba(96,165,250,0.15);
    border-color: rgba(96,165,250,0.35);
    color: var(--blue);
}
.btn-blue:hover {
    background: rgba(96,165,250,0.25);
}

.btn-red {
    background: rgba(239,68,68,0.1);
    border-color: rgba(239,68,68,0.3);
    color: #f87171;
}
.btn-red:hover {
    background: rgba(239,68,68,0.2);
}

.btn-gray {
    background: rgba(255,255,255,0.05);
    border-color: var(--border-light);
    color: var(--text-secondary);
}
.btn-gray:hover {
    background: rgba(255,255,255,0.1);
}

html.light .btn-gray {
    background: rgba(0,0,0,0.04);
    border-color: var(--border-light);
}
html.light .btn-gray:hover {
    background: rgba(0,0,0,0.08);
}

.btn-primary {
    background: rgba(96,165,250,0.15);
    border: 1px solid rgba(96,165,250,0.35);
    color: var(--blue);
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-primary:hover {
    background: rgba(96,165,250,0.25);
}
.btn-primary:disabled {
    opacity: 0.35;
    cursor: default;
}

.dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 7px;
    border: 1px solid rgba(96,165,250,0.3);
    color: var(--blue);
    background: rgba(96,165,250,0.07);
    cursor: pointer;
    transition: background 0.15s;
    font-family: 'Inter', sans-serif;
}
.dl-btn:hover {
    background: rgba(96,165,250,0.14);
}
.dl-btn:disabled {
    opacity: 0.3;
    cursor: default;
}


/* --------------------------------------------------------------------------
   9. Tags
   -------------------------------------------------------------------------- */
.tag {
    display: inline-block;
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 20px;
    font-family: 'JetBrains Mono', monospace;
}

.tag-admin {
    background: rgba(167,139,250,0.15);
    color: var(--purple);
    border: 1px solid rgba(167,139,250,0.25);
}

.tag-user {
    background: rgba(96,165,250,0.1);
    color: var(--blue);
    border: 1px solid rgba(96,165,250,0.2);
}


/* --------------------------------------------------------------------------
   10. Tabs
   -------------------------------------------------------------------------- */
.tab-btn {
    color: var(--text-muted);
    transition: color 0.15s, border-color 0.15s;
    border-bottom: 2px solid transparent;
    padding-bottom: 8px;
    font-size: 14px;
    background: none;
    cursor: pointer;
}

.tab-btn.active {
    color: var(--blue);
    border-color: var(--blue);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}


/* --------------------------------------------------------------------------
   11. Form Inputs
   -------------------------------------------------------------------------- */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 7px 11px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
    font-family: 'Inter', sans-serif;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(96,165,250,0.5);
}

html.light input[type="text"],
html.light input[type="password"],
html.light input[type="email"],
html.light input[type="number"],
html.light input[type="datetime-local"],
html.light select,
html.light textarea {
    background: rgba(0,0,0,0.03);
    border-color: var(--border-light);
}

input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
}

html.light input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: none;
}


/* --------------------------------------------------------------------------
   12. Cards
   -------------------------------------------------------------------------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 18px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

html.light .stat-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}


/* --------------------------------------------------------------------------
   13. Gradient Text
   -------------------------------------------------------------------------- */
.gradient-text {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #f472b6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


/* --------------------------------------------------------------------------
   14. Custom Scrollbar
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.18);
}

html.light ::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.12);
}

html.light ::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.2);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

html.light * {
    scrollbar-color: rgba(0,0,0,0.12) transparent;
}


/* --------------------------------------------------------------------------
   15. Skeleton Loading
   -------------------------------------------------------------------------- */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0.04) 25%,
        rgba(255,255,255,0.08) 50%,
        rgba(255,255,255,0.04) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

html.light .skeleton {
    background: linear-gradient(
        90deg,
        rgba(0,0,0,0.04) 25%,
        rgba(0,0,0,0.08) 50%,
        rgba(0,0,0,0.04) 75%
    );
    background-size: 200% 100%;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* --------------------------------------------------------------------------
   16. Toast Notifications
   -------------------------------------------------------------------------- */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 13px;
    color: var(--text-primary);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    transform: translateY(20px);
    opacity: 0;
    animation: toast-in 0.3s ease forwards;
}

html.light .toast {
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}

.toast.toast-out {
    animation: toast-out 0.25s ease forwards;
}

@keyframes toast-in {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toast-out {
    to {
        transform: translateY(20px);
        opacity: 0;
    }
}


/* --------------------------------------------------------------------------
   17. Navigation Bar
   -------------------------------------------------------------------------- */
.nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 10;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: 600;
    letter-spacing: -0.02em;
    text-decoration: none;
}

html.light .nav-logo {
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
}

.nav-pill {
    color: var(--text-secondary);
    padding: 5px 10px;
    border-radius: 8px;
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
}

.nav-pill:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

html.light .nav-pill:hover {
    color: var(--text-primary);
    background: rgba(0,0,0,0.04);
}

.nav-pill.active {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

html.light .nav-pill.active {
    color: var(--text-primary);
    background: rgba(0,0,0,0.06);
}

.nav-signout {
    color: var(--text-muted);
    font-size: 12px;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.15s;
    margin-left: 8px;
}

.nav-signout:hover {
    color: var(--red);
}

.nav-tools-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-muted);
    background: none;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.nav-tools-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-light);
}


/* --------------------------------------------------------------------------
   18. Modal
   -------------------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

html.light .modal-overlay {
    background: rgba(0,0,0,0.4);
}

.modal-overlay.hidden {
    display: none;
}

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    padding: 24px;
    animation: modal-enter 0.2s ease;
}

@keyframes modal-enter {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}


/* --------------------------------------------------------------------------
   19. Keyframes — Pulse & Ripple
   -------------------------------------------------------------------------- */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.3; }
}

@keyframes ripple {
    0%   { transform: scale(1);   opacity: 0.7; }
    100% { transform: scale(3.5); opacity: 0; }
}


/* --------------------------------------------------------------------------
   20. Responsive — Mobile Nav
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
    .nav-bar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 14px;
    }

    .nav-links {
        order: 3;
        width: 100%;
        overflow-x: auto;
        gap: 2px;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .nav-pill {
        white-space: nowrap;
        font-size: 13px;
        padding: 4px 8px;
    }

    .nav-signout {
        margin-left: auto;
    }
}
