/**
 * CARES Layout CSS
 * Shared styles for the CARES component system
 * Version: 4.0
 */

/* ============================================================
   CSS VARIABLES
   ============================================================ */
:root {
    --header-height: 64px;
    --sidebar-width: 280px;
    --menu-width: 300px;
    --primary: #06B6D4;
    --secondary: #8B5CF6;
}

/* ============================================================
   BASE STYLES
   ============================================================ */
body {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
    min-height: 100vh;
    margin: 0;
    font-family: system-ui, -apple-system, sans-serif;
    overflow-x: hidden;
}

.glass {
    background: rgba(17, 24, 39, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hidden { display: none !important; }

/* ============================================================
   HEADER - Fixed at top
   ============================================================ */
#cares-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-logo {
    height: 40px;
    width: 40px;
    border-radius: 0.5rem;
}

.header-brand-name {
    font-size: 1.25rem;
    font-weight: bold;
}

.header-brand-tagline {
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.5);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Hamburger Button */
#menu-hamburger {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    transition: all 0.2s;
}

#menu-hamburger:hover {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--primary);
}

#menu-hamburger.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: transparent;
}

#menu-hamburger svg {
    width: 20px;
    height: 20px;
    color: white;
}

/* Logout Button */
.logout-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    color: white;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
}

/* ============================================================
   MAIN MENU - Slides from RIGHT, BELOW header
   ============================================================ */
#menu-overlay {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

#menu-overlay.visible {
    opacity: 1;
    visibility: visible;
}

#cares-menu {
    position: fixed;
    top: var(--header-height);
    right: 0;
    width: var(--menu-width);
    height: calc(100vh - var(--header-height));
    z-index: 950;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#cares-menu.open {
    transform: translateX(0);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

/* Menu Content */
.menu-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-header-title {
    font-weight: 600;
    color: white;
    font-size: 0.875rem;
}

.menu-header-subtitle {
    font-size: 0.688rem;
    color: rgba(255, 255, 255, 0.5);
}

.menu-section {
    padding: 0.5rem;
}

.menu-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    font-size: 0.688rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    border-radius: 0.375rem;
}

.menu-section-header:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
}

.menu-section-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s;
}

.menu-section-items.expanded {
    max-height: 500px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    margin: 0.125rem 0;
    border-radius: 0.375rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.813rem;
    transition: all 0.2s;
}

.menu-item:hover {
    background: rgba(6, 182, 212, 0.15);
    color: var(--primary);
}

.menu-item-icon {
    width: 1.125rem;
    font-size: 1rem;
}

.menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0.5rem 0.75rem;
}

.menu-footer {
    margin-top: auto;
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.3);
}

/* ============================================================
   SIDEBAR - LEFT side, BELOW header
   ============================================================ */
#sidebar-toggle {
    display: none;
    position: fixed;
    top: calc(var(--header-height) + 0.75rem);
    left: 0.75rem;
    z-index: 800;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
}

#sidebar-toggle svg {
    width: 18px;
    height: 18px;
    color: white;
}

@media (max-width: 1023px) {
    #sidebar-toggle {
        display: flex;
    }
}

#sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 700;
}

#sidebar-overlay.visible {
    display: block;
}

#cares-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    z-index: 750;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 1024px) {
    #cares-sidebar {
        transform: translateX(0);
    }
}

@media (max-width: 1023px) {
    #cares-sidebar {
        transform: translateX(-100%);
    }

    #cares-sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }
}

/* Sidebar User Section */
.sidebar-user {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(139, 92, 246, 0.15));
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
    position: relative;
}

.sidebar-user-card:hover {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.25), rgba(139, 92, 246, 0.25));
    border-color: rgba(139, 92, 246, 0.3);
}

.sidebar-user-tooltip {
    position: absolute;
    bottom: -2rem;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.sidebar-user-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 6px 6px 6px;
    border-style: solid;
    border-color: transparent transparent var(--primary) transparent;
}

.sidebar-user-card:hover .sidebar-user-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
}

.sidebar-user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
}

.sidebar-user-points {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
}

.sidebar-user-rank {
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.5);
}

.sidebar-role-badge {
    display: inline-block;
    font-size: 0.5rem;
    font-weight: 700;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    margin-left: 0.5rem;
    text-transform: uppercase;
}

.sidebar-role-badge.admin {
    background: linear-gradient(135deg, #F59E0B, #EF4444);
    color: white;
}

.sidebar-role-badge.manager {
    background: linear-gradient(135deg, var(--secondary), #6366F1);
    color: white;
}

/* Manager Hub Quick Link */
.sidebar-manager-hub {
    padding: 0.5rem;
}

.sidebar-manager-hub-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.375rem;
    background: linear-gradient(270deg, rgba(139, 92, 246, 0.15) 0%, rgba(6, 182, 212, 0.1) 100%);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-left: 3px solid #8B5CF6;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: all 0.15s ease;
}

.sidebar-manager-hub-link:hover {
    background: linear-gradient(270deg, rgba(139, 92, 246, 0.25) 0%, rgba(6, 182, 212, 0.15) 100%);
    border-color: rgba(139, 92, 246, 0.4);
    color: white;
    transform: translateX(-2px);
}

.sidebar-manager-hub-icon {
    font-size: 0.875rem;
    flex-shrink: 0;
}

.sidebar-manager-hub-text {
    flex: 1;
    font-weight: 500;
}

.sidebar-manager-hub-arrow {
    font-size: 0.75rem;
    color: rgba(139, 92, 246, 0.7);
    transition: all 0.15s ease;
}

.sidebar-manager-hub-link:hover .sidebar-manager-hub-arrow {
    transform: translateX(2px);
    color: #8B5CF6;
}

/* Quick Action Links Container */
.sidebar-quick-links {
    padding: 0.75rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Quick Action Link Base */
.sidebar-quick-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.375rem;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: all 0.15s ease;
}

.sidebar-quick-link:hover {
    transform: translateX(2px);
    color: white;
}

.sidebar-quick-link-icon {
    font-size: 0.875rem;
    flex-shrink: 0;
}

.sidebar-quick-link-text {
    flex: 1;
    font-weight: 500;
}

.sidebar-quick-link-arrow {
    font-size: 0.75rem;
    transition: all 0.15s ease;
}

.sidebar-quick-link:hover .sidebar-quick-link-arrow {
    transform: translateX(2px);
}

/* Admin Panel Link - Gold */
.sidebar-quick-link.admin-panel {
    background: linear-gradient(270deg, rgba(234, 179, 8, 0.15) 0%, rgba(245, 158, 11, 0.1) 100%);
    border: 1px solid rgba(234, 179, 8, 0.25);
    border-left: 3px solid #EAB308;
}

.sidebar-quick-link.admin-panel:hover {
    background: linear-gradient(270deg, rgba(234, 179, 8, 0.25) 0%, rgba(245, 158, 11, 0.15) 100%);
    border-color: rgba(234, 179, 8, 0.4);
}

.sidebar-quick-link.admin-panel .sidebar-quick-link-arrow {
    color: rgba(234, 179, 8, 0.7);
}

.sidebar-quick-link.admin-panel:hover .sidebar-quick-link-arrow {
    color: #EAB308;
}

/* Manager Hub Link - Purple */
.sidebar-quick-link.manager-hub {
    background: linear-gradient(270deg, rgba(139, 92, 246, 0.15) 0%, rgba(6, 182, 212, 0.1) 100%);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-left: 3px solid #8B5CF6;
}

.sidebar-quick-link.manager-hub:hover {
    background: linear-gradient(270deg, rgba(139, 92, 246, 0.25) 0%, rgba(6, 182, 212, 0.15) 100%);
    border-color: rgba(139, 92, 246, 0.4);
}

.sidebar-quick-link.manager-hub .sidebar-quick-link-arrow {
    color: rgba(139, 92, 246, 0.7);
}

.sidebar-quick-link.manager-hub:hover .sidebar-quick-link-arrow {
    color: #8B5CF6;
}

/* Dashboard Link - Cyan */
.sidebar-quick-link.dashboard {
    background: linear-gradient(270deg, rgba(6, 182, 212, 0.15) 0%, rgba(59, 130, 246, 0.1) 100%);
    border: 1px solid rgba(6, 182, 212, 0.25);
    border-left: 3px solid #06B6D4;
}

.sidebar-quick-link.dashboard:hover {
    background: linear-gradient(270deg, rgba(6, 182, 212, 0.25) 0%, rgba(59, 130, 246, 0.15) 100%);
    border-color: rgba(6, 182, 212, 0.4);
}

.sidebar-quick-link.dashboard .sidebar-quick-link-arrow {
    color: rgba(6, 182, 212, 0.7);
}

.sidebar-quick-link.dashboard:hover .sidebar-quick-link-arrow {
    color: #06B6D4;
}

/* Sidebar Sections */
.sidebar-section {
    padding: 0.5rem;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.625rem;
    font-size: 0.688rem;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    border-radius: 0.375rem;
}

.sidebar-section-header:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
}

.sidebar-section-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s;
}

.sidebar-section-items.expanded {
    max-height: 500px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.625rem;
    margin: 0.125rem 0;
    border-radius: 0.375rem;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 0.813rem;
    transition: all 0.2s;
}

.sidebar-item:hover {
    background: rgba(139, 92, 246, 0.15);
    color: #A78BFA;
}

.sidebar-item.active {
    background: rgba(6, 182, 212, 0.15);
    color: var(--primary);
}

.sidebar-item.highlight {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(139, 92, 246, 0.15));
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.sidebar-item-icon {
    width: 1rem;
    flex-shrink: 0;
}

.sidebar-item-count {
    font-size: 0.625rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.sidebar-item-badge {
    font-size: 0.5rem;
    font-weight: 700;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    background: linear-gradient(135deg, #F59E0B, #EF4444);
    color: white;
    text-transform: uppercase;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0.5rem 0.625rem;
}

/* ============================================================
   MAIN CONTENT - Adjusts for sidebar
   ============================================================ */
.main-content {
    padding-top: calc(var(--header-height) + 1.5rem);
    padding-bottom: 2rem;
    min-height: calc(100vh - 120px);
}

@media (min-width: 1024px) {
    .main-content {
        margin-left: var(--sidebar-width);
    }
}

/* ============================================================
   FOOTER - Below content, accounts for sidebar
   ============================================================ */
#cares-footer {
    padding: 1.5rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

@media (min-width: 1024px) {
    #cares-footer {
        margin-left: var(--sidebar-width);
    }
}

/* ============================================================
   CARDS & UI COMPONENTS
   ============================================================ */
.card {
    background: rgba(31, 41, 55, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.card-body {
    padding: 1.5rem;
}

.stat-card {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    padding: 1.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: bold;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Navigation Cards */
.nav-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    border-radius: 0.75rem;
    background: rgba(31, 41, 55, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-decoration: none;
    transition: all 0.2s;
    text-align: center;
}

.nav-card:hover {
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.3);
    transform: translateY(-2px);
}

.nav-card-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.nav-card-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
    margin-bottom: 0.25rem;
}

.nav-card-desc {
    font-size: 0.688rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Action Cards */
.action-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.08), rgba(139, 92, 246, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-decoration: none;
    transition: all 0.2s;
}

.action-card:hover {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(139, 92, 246, 0.15));
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateX(4px);
}

.action-card-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.action-card-content {
    flex: 1;
    min-width: 0;
}

.action-card-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
}

.action-card-desc {
    font-size: 0.688rem;
    color: rgba(255, 255, 255, 0.5);
}

.action-card-arrow {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.3);
    transition: all 0.2s;
}

.action-card:hover .action-card-arrow {
    color: var(--primary);
    transform: translateX(4px);
}

/* Project Points */
.project-points-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
}

.project-points-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.625rem;
    border-radius: 0.375rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.project-points-icon {
    width: 28px;
    height: 28px;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.project-points-info {
    flex: 1;
    min-width: 0;
}

.project-points-name {
    font-weight: 600;
    font-size: 0.75rem;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-points-role {
    font-size: 0.563rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
}

.project-points-value {
    font-weight: 700;
    font-size: 0.875rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}

/* Activity Items */
.activity-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-text {
    font-size: 0.813rem;
    color: white;
}

.activity-time {
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.4);
}

.activity-points {
    font-weight: 600;
    font-size: 0.813rem;
    color: #22C55E;
}
