/*
Theme Name: Hublee
Theme URI: https://hublee.co
Author: Solutions M
Author URI: https://solutionsm.ca
Description: Dark theme for Hublee portal - Solutions M internal tools hub
Version: 4.4.1
License: Proprietary
Text Domain: hublee
*/

/* ==================== RESET & FONTS ==================== */
/* Fonts loaded via page-dashboard.php <link> to avoid duplicate requests */

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

:root {
    /* Backgrounds — aligned with styles.css naming */
    --bg-darkest: #050507;
    --bg-dark: #0a0a0f;
    --bg-primary: #0f1419;
    --bg-secondary: #1a1f2e;
    --bg-tertiary: #242b3d;
    --bg-card: #1e2433;
    --bg-hover: #2a3244;

    /* Borders — aligned with styles.css */
    --border: rgba(255,255,255,0.06);
    --border-light: rgba(255,255,255,0.1);
    --border-hover: rgba(255,255,255,0.15);
    --border-color: #2d3748;

    /* Text — aligned with styles.css */
    --text: #ffffff;
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --text-muted: #8490a0;
    --text-faint: rgba(255,255,255,0.3);

    /* Accent — aligned with styles.css (purple primary) */
    --accent: #8b5cf6;
    --accent-hover: #a78bfa;
    --accent-light: rgba(139, 92, 246, 0.15);
    --accent-primary: #8b5cf6;
    --accent-secondary: #a78bfa;
    --accent-success: #22c55e;
    --accent-warning: #eab308;
    --accent-danger: #ef4444;
    --accent-info: #3b82f6;

    /* Status */
    --success: #22c55e;
    --success-light: rgba(34, 197, 94, 0.15);
    --warning: #eab308;
    --warning-light: rgba(234, 179, 8, 0.15);
    --error: #ef4444;
    --error-light: rgba(239, 68, 68, 0.15);

    /* Typography */
    --font-heading: 'Syne', sans-serif;
    --font-body: 'Space Grotesk', sans-serif;

    /* Spacing */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);

    /* Transitions */
    --transition: 0.2s ease;
    --transition-bounce: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 64px;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--bg-darkest);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* ==================== TYPOGRAPHY ==================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
}

h1 { font-size: 2rem; font-weight: 800; }
h2 { font-size: 1.5rem; margin-bottom: 16px; }
h3 { font-size: 1.125rem; }

p {
    color: var(--text-secondary);
    line-height: 1.7;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent-hover);
}

/* ==================== LAYOUT ==================== */
.hublee-app {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

.hublee-main {
    padding: 32px 40px;
    background: var(--bg-darkest);
    overflow-y: auto;
    min-height: 100vh;
}

.hublee-page-header {
    margin-bottom: 32px;
}

.hublee-page-header h1 {
    margin-bottom: 8px;
}

.hublee-page-header p {
    font-size: 0.9375rem;
}

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

.hublee-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px;
    margin-bottom: 24px;
    cursor: pointer;
    text-decoration: none;
}

.hublee-logo svg {
    width: 36px;
    height: 36px;
}

.hublee-logo span {
    font-family: var(--font-heading);
    font-size: 1.375rem;
    font-weight: 800;
    color: var(--text);
}

/* Org Selector */
.hublee-org-selector {
    margin-bottom: 24px;
}

.hublee-org-current {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition);
}

.hublee-org-current:hover {
    border-color: var(--border-light);
    background: var(--bg-hover);
}

.hublee-org-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hublee-org-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), #0d5c5f);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
}

.hublee-org-name {
    font-weight: 600;
    font-size: 0.875rem;
}

.hublee-org-type {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.hublee-org-chevron {
    font-size: 0.625rem;
    color: var(--text-muted);
}

/* Navigation */
.hublee-nav {
    flex: 1;
}

.hublee-nav-section {
    margin-bottom: 24px;
}

.hublee-nav-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-faint);
    padding: 0 12px;
    margin-bottom: 8px;
}

.hublee-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
    text-decoration: none;
    margin-bottom: 2px;
}

.hublee-nav-item:hover {
    background: var(--bg-card);
    color: var(--text);
}

.hublee-nav-item.active {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
}

.hublee-nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.hublee-nav-item .hublee-badge {
    margin-left: auto;
}

/* Sidebar Footer */
.hublee-sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.hublee-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition);
}

.hublee-user-card:hover {
    background: var(--bg-card);
}

.hublee-user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

.hublee-user-name {
    font-weight: 600;
    font-size: 0.875rem;
}

.hublee-user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==================== CARDS ==================== */
.hublee-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 24px;
    transition: all var(--transition);
}

.hublee-card:hover {
    border-color: var(--border-light);
}

/* Stat Cards */
.hublee-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 24px;
}

.hublee-stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.hublee-stat-value {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.hublee-stat-change {
    font-size: 0.8125rem;
    color: var(--success);
}

/* Tool Cards */
.hublee-tool-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 24px;
    transition: all var(--transition-bounce);
    cursor: pointer;
    text-decoration: none;
}

.hublee-tool-card:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
    transform: translateY(-8px) scale(1.02);
}

.hublee-tool-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.hublee-tool-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent), #0d5c5f);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hublee-tool-icon svg {
    width: 28px;
    height: 28px;
}

.hublee-tool-name {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.hublee-tool-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ==================== BADGES ==================== */
.hublee-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.hublee-badge-success {
    background: var(--success-light);
    color: var(--success);
}

.hublee-badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.hublee-badge-error {
    background: var(--error-light);
    color: var(--error);
}

.hublee-badge-accent {
    background: var(--accent-light);
    color: var(--accent);
}

.hublee-badge-night {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    margin-left: 8px;
}

/* ==================== BUTTONS ==================== */
.hublee-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.hublee-btn-primary {
    background: var(--text);
    color: var(--bg-darkest);
}

.hublee-btn-primary:hover {
    opacity: 0.9;
    color: var(--bg-darkest);
}

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

.hublee-btn-secondary:hover {
    border-color: var(--border-light);
    color: var(--text);
}

.hublee-btn-accent {
    background: var(--accent);
    color: white;
}

.hublee-btn-accent:hover {
    background: var(--accent-hover);
    color: white;
}

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

.hublee-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text);
}

.hublee-input,
.hublee-select,
.hublee-textarea {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.875rem;
    transition: all var(--transition);
}

.hublee-input:focus,
.hublee-select:focus,
.hublee-textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-hover);
}

.hublee-input::placeholder,
.hublee-textarea::placeholder {
    color: var(--text-muted);
}

.hublee-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.hublee-textarea {
    resize: vertical;
    min-height: 100px;
}

/* ==================== GRIDS ==================== */
.hublee-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.hublee-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.hublee-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* ==================== LOADER ==================== */
.hublee-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-darkest);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.hublee-loader-orbit {
    position: relative;
    width: 120px;
    height: 120px;
    animation: orbit-rotate 3s linear infinite;
}

.hublee-loader-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.hublee-loader-center svg {
    width: 50px;
    height: 50px;
    animation: pulse 2s ease-in-out infinite;
}

.hublee-loader-text {
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

@keyframes orbit-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* ==================== TOAST ==================== */
.hublee-toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10000;
}

.hublee-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.hublee-toast .emoji {
    font-size: 1.5rem;
}

.hublee-toast .message {
    font-weight: 600;
}

/* ==================== CONFETTI ==================== */
.hublee-confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -20px;
    animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1200px) {
    .hublee-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 80px;
    }
    
    .hublee-sidebar {
        padding: 16px 8px;
    }
    
    .hublee-logo span,
    .hublee-org-selector,
    .hublee-nav-title,
    .hublee-nav-item span,
    .hublee-user-info {
        display: none;
    }
    
    .hublee-nav-item {
        justify-content: center;
        padding: 12px;
    }
    
    .hublee-user-card {
        justify-content: center;
    }
    
    .hublee-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .hublee-app {
        grid-template-columns: 1fr;
    }
    
    .hublee-sidebar {
        display: none;
    }
    
    .hublee-main {
        padding: 24px 20px;
    }
    
    .hublee-grid-4,
    .hublee-grid-3,
    .hublee-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* ==================== WORDPRESS OVERRIDES ==================== */
.admin-bar .hublee-sidebar {
    top: 32px;
    height: calc(100vh - 32px);
}

@media (max-width: 782px) {
    .admin-bar .hublee-sidebar {
        top: 46px;
        height: calc(100vh - 46px);
    }
}

/* Timer stability — prevent width jitter */
.h4-clock, .h4-elapsed, .h4-clock-ss, [class*="punch-timer"], [class*="elapsed"], [class*="timer"] {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}
.h4-clock { min-width: 90px; text-align: right; }
.h4-elapsed { min-width: 80px; text-align: center; }

/* Accessibility — Focus visible */
*:focus-visible {
    outline: 2px solid var(--accent-primary, #8b5cf6);
    outline-offset: 2px;
    border-radius: 4px;
}
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Hide default WP stuff */
.wp-block-post-title,
.entry-title {
    display: none;
}
