/**
 * TrixTasks Calendar - Modern Design (Replit-Inspired)
 * 3-Panel Layout with Glass Morphism & Modern Effects
 * Version: 3.1.6
 */

/* ====================
   CSS VARIABLES
   ==================== */
:root {
    /* Colors */
    --color-primary: hsl(263, 70%, 50%);
    --color-primary-hover: hsl(263, 70%, 45%);
    --color-secondary: hsl(220, 70%, 50%);
    --color-background: hsl(0, 0%, 99%);
    --color-foreground: hsl(240, 10%, 4%);
    --color-muted: hsl(240, 5%, 64%);
    --color-muted-foreground: hsl(240, 4%, 46%);
    --color-border: hsl(240, 6%, 90%);
    --color-sidebar-bg: hsla(240, 10%, 98%, 0.5);
    --color-sidebar-border: hsl(240, 6%, 92%);
    
    /* Fonts */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Outfit', 'Plus Jakarta Sans', var(--font-sans);
    
    /* Spacing */
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Sidebar Widths */
    --sidebar-left-width: 16rem;
    --sidebar-left-collapsed: 5rem;
    --sidebar-right-width: 18.75rem;
    
    /* Z-index */
    --z-sidebar: 10;
    --z-modal: 20;
    --z-mobile-nav: 15;
}

/* ====================
   RESET & BASE
   ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.trixtasks-calendar-page {
    font-family: var(--font-sans);
    background: var(--color-background);
    color: var(--color-foreground);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* WordPress Admin Override */
.trixtasks-calendar-page #wpcontent {
    padding-left: 0 !important;
    height: 100vh;
}

.trixtasks-calendar-page #wpbody {
    height: 100%;
}

.trixtasks-calendar-page #wpbody-content {
    height: 100%;
    padding-bottom: 0 !important;
    float: none !important;
}

.trixtasks-wrap {
    margin: 0 !important;
    padding: 0 !important;
    height: 100vh;
    width: 100%;
    max-width: none !important;
}

/* ====================
   MAIN APP LAYOUT
   ==================== */
.trixtasks-calendar-app {
    display: flex !important;
    height: 100vh;
    width: 100%;
    overflow: hidden;
    position: relative;
    background: var(--color-background);
}

/* ====================
   LEFT SIDEBAR
   ==================== */
.trixtasks-sidebar-left {
    width: var(--sidebar-left-width);
    min-width: var(--sidebar-left-width);
    height: 100vh;
    background: var(--color-sidebar-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-right: 1px solid var(--color-sidebar-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: var(--z-sidebar);
    transition: width 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px hsla(263, 70%, 50%, 0.3);
}

.logo-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.75rem;
    border: none;
    background: transparent;
    color: var(--color-muted-foreground);
    cursor: pointer;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 500;
    text-align: left;
    width: 100%;
}

.nav-item:hover {
    background: hsla(240, 10%, 50%, 0.08);
    color: var(--color-foreground);
}

.nav-item.active {
    background: linear-gradient(135deg, hsla(263, 70%, 50%, 0.1), hsla(220, 70%, 50%, 0.1));
    color: var(--color-primary);
    font-weight: 600;
    box-shadow: 0 2px 8px hsla(263, 70%, 50%, 0.1);
}

.nav-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.nav-label {
    flex: 1;
}

.nav-indicator {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 2rem;
    background: var(--color-primary);
    border-radius: 0 999px 999px 0;
    opacity: 0;
    transition: opacity 200ms;
}

.nav-item.active .nav-indicator {
    opacity: 1;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--color-border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: background 200ms;
}

.user-profile:hover {
    background: hsla(240, 10%, 50%, 0.05);
}

.user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: linear-gradient(135deg, hsl(280, 70%, 60%), hsl(210, 70%, 60%));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.875rem;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-info {
    flex: 1;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--color-foreground);
}

.user-role {
    font-size: 0.75rem;
    color: var(--color-muted-foreground);
    line-height: 1.2;
}

/* ====================
   MAIN CONTENT AREA
   ==================== */
.trixtasks-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.trixtasks-topbar {
    height: 3.5rem;
    border-bottom: 1px solid hsla(240, 6%, 90%, 0.4);
    background: hsla(0, 0%, 100%, 0.5);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 10;
}

.topbar-mobile-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.125rem;
}

.topbar-mobile-logo .logo-icon {
    width: 2rem;
    height: 2rem;
}

.calendar-canvas {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 1rem;
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-state p {
    color: var(--color-muted-foreground);
    font-size: 0.875rem;
}

/* ====================
   RIGHT SIDEBAR (Rose AI)
   ==================== */
.trixtasks-sidebar-right {
    width: var(--sidebar-right-width);
    min-width: var(--sidebar-right-width);
    height: 100vh;
    background: hsla(0, 0%, 100%, 0.8);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-left: 1px solid var(--color-sidebar-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: var(--z-sidebar);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.04);
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.trixtasks-sidebar-right.hidden {
    transform: translateX(100%);
}

.rose-sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.5rem;
}

.rose-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.rose-avatar-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.rose-avatar {
    position: relative;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, hsl(330, 70%, 60%), hsl(280, 70%, 60%));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 16px hsla(330, 70%, 60%, 0.2);
}

.rose-status-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 0.75rem;
    height: 0.75rem;
    background: hsl(145, 70%, 50%);
    border: 2px solid white;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.95); }
}

.rose-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.125rem;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.rose-subtitle {
    font-size: 0.75rem;
    color: var(--color-muted-foreground);
    line-height: 1;
}

.rose-close-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--color-muted-foreground);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 200ms;
}

.rose-close-btn:hover {
    background: hsla(240, 10%, 50%, 0.1);
    color: var(--color-foreground);
}

.rose-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: linear-gradient(135deg, hsla(260, 70%, 50%, 0.1), hsla(260, 70%, 50%, 0.05));
    border: 1px solid hsla(260, 70%, 50%, 0.2);
    border-radius: 1rem;
    padding: 1rem;
    transition: transform 200ms, box-shadow 200ms;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px hsla(260, 70%, 50%, 0.15);
}

.stat-card.stat-energy {
    background: linear-gradient(135deg, hsla(45, 90%, 50%, 0.1), hsla(45, 90%, 50%, 0.05));
    border-color: hsla(45, 90%, 50%, 0.2);
}

.stat-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--color-primary);
}

.stat-card.stat-energy .stat-header {
    color: hsl(45, 90%, 50%);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.5rem;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--color-foreground);
}

.rose-suggestions {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-right: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

.rose-suggestions::-webkit-scrollbar {
    width: 6px;
}

.rose-suggestions::-webkit-scrollbar-track {
    background: transparent;
}

.rose-suggestions::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

.suggestion-bubble {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 1rem;
    padding: 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--color-foreground);
    transition: all 200ms;
}

.suggestion-bubble:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.rose-message {
    background: linear-gradient(135deg, hsla(260, 70%, 50%, 0.05), hsla(220, 70%, 50%, 0.05));
    border-color: hsla(260, 70%, 50%, 0.2);
    border-radius: 1rem 1rem 1rem 0.25rem;
}

.user-suggestion {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    cursor: pointer;
}

.suggestion-dot {
    width: 0.375rem;
    height: 0.375rem;
    background: var(--color-primary);
    border-radius: 50%;
    margin-top: 0.5rem;
    flex-shrink: 0;
}

.rose-input-area {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.rose-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.rose-input {
    width: 100%;
    background: hsla(240, 10%, 50%, 0.05);
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    font-size: 0.875rem;
    font-family: var(--font-sans);
    color: var(--color-foreground);
    transition: all 200ms;
}

.rose-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px hsla(263, 70%, 50%, 0.1);
    background: white;
}

.rose-input::placeholder {
    color: var(--color-muted-foreground);
}

.rose-send-btn {
    position: absolute;
    right: 0.5rem;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.5rem;
    border: none;
    background: white;
    color: var(--color-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 200ms;
}

.rose-send-btn:hover {
    background: var(--color-primary);
    color: white;
    transform: scale(1.05);
}

.rose-toggle-btn {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2rem;
    height: 3rem;
    background: white;
    border: 1px solid var(--color-sidebar-border);
    border-right: none;
    border-radius: 0.5rem 0 0 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-muted-foreground);
    z-index: var(--z-sidebar);
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.05);
    transition: all 200ms;
}

.rose-toggle-btn:hover {
    background: hsla(240, 10%, 50%, 0.05);
    color: var(--color-foreground);
}

/* ====================
   MOBILE BOTTOM NAV
   ==================== */
/* Replit-style Mobile Navigation */
.trixtasks-mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--color-border);
    z-index: 15;
    padding: 0 0.5rem;
    padding-bottom: env(safe-area-inset-bottom, 0);
    align-items: center;
    justify-content: space-around;
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 0.25rem;
    border: none;
    background: transparent;
    color: var(--color-muted-foreground);
    cursor: pointer;
    transition: color 150ms;
}

.mobile-nav-item.active {
    color: var(--color-primary);
}

.mobile-nav-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem;
    border-radius: 9999px;
    transition: background 150ms;
}

.mobile-nav-item.active .mobile-nav-icon-wrapper {
    background: hsla(263, 70%, 50%, 0.1);
}

.mobile-nav-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.mobile-nav-label {
    font-size: 0.625rem;
    font-weight: 500;
}

/* ====================
   RESPONSIVE
   ==================== */
@media (max-width: 768px) {
    .trixtasks-sidebar-left {
        display: none;
    }
    
    .trixtasks-sidebar-right {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 24rem;
        transform: translateX(100%);
    }
    
    .trixtasks-sidebar-right.open {
        transform: translateX(0);
    }
    
    .trixtasks-mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 4rem;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid #e5e5e5;
        padding: 0 0.5rem;
        padding-bottom: env(safe-area-inset-bottom, 0);
        justify-content: space-around;
        align-items: center;
        z-index: 100;
    }
    
    .trixtasks-topbar {
        display: flex;
    }
    
    .rose-toggle-btn {
        display: none !important;
    }
    
    /* Mobile height: full viewport minus header, with space for bottom nav */
    .trixtasks-calendar-app {
        height: calc(100vh - 100px) !important;
        min-height: calc(100vh - 100px) !important;
    }
    
    .trixtasks-main-content {
        height: calc(100vh - 100px - 4rem - env(safe-area-inset-bottom, 0px)) !important;
        overflow-y: auto;
        padding-bottom: 1rem;
    }
    
    .calendar-canvas {
        padding-bottom: 1rem !important;
    }
    
    /* Hide week tab on mobile */
    .mobile-nav-item[data-view="week"] {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .trixtasks-topbar {
        display: none;
    }
    
    .trixtasks-mobile-nav {
        display: none !important;
    }
    
    /* Ensure sidebars are visible on desktop */
    .trixtasks-sidebar-left {
        display: flex !important;
    }
    
    .trixtasks-sidebar-right {
        display: flex !important;
        position: relative;
        transform: none;
    }
}

@media (min-width: 1024px) {
    .trixtasks-sidebar-left {
        width: var(--sidebar-left-width);
    }
    
    .sidebar-logo .logo-text,
    .nav-label,
    .user-info {
        display: block;
    }
}

@media (max-width: 1023px) and (min-width: 769px) {
    .trixtasks-sidebar-left {
        width: var(--sidebar-left-collapsed);
    }
    
    .sidebar-logo .logo-text,
    .nav-label,
    .user-info {
        display: none;
    }
    
    .sidebar-nav {
        align-items: center;
    }
    
    .nav-item {
        justify-content: center;
        padding: 0.75rem;
    }
}

/* ====================
   UTILITY CLASSES
   ==================== */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
