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

:root {
    /* JUNE Colors */
    --primary: #144560;
    --primary-dark: #133a4d;
    --primary-light: #217280;
    --secondary: #00c1c5;
    --secondary-light: #2ff3e0;
    --success: #2e612a;
    --warning: #b4a496;
    --danger: #722434;
    --info: #205b79;

    /* JUNE Text */
    --dark: #121314;
    --text-disabled: #495057;
    --gray: #5b5c5c;
    --light-gray: #bbbcbc;
    --bg: #f0f0f0;
    --white: #ffffff;

    /* JUNE Petrol */
    --petrol: #0f4662;
    --petrol-lighter: #2f6884;
    --petrol-light: #b4cedd;
    --petrol-extra-light: #e6f0fa;

    /* JUNE Beige */
    --beige: #e5e5e5;
    --beige-gold: #b5a596;
    --beige-gold-light: #d7c7b8;

    /* Role Colors */
    --role-pm: #a9906e;
    --role-dev: #217280;
    --role-lead-dev: #205b79;
    --role-to: #722434;
    --role-cs: #005968;

    /* Gradients */
    --ai-gradient: linear-gradient(135deg, #2ff3e0 0%, #00c1c5 100%);
    --header-gradient: linear-gradient(135deg, #144560 0%, #205b79 100%);

    /* Shadows */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #144560 0%, #205b79 100%);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* ======================
   HEADER
   ====================== */

header {
    background: var(--white);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
}

.header-content h1 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
    text-align: center;
}

.controls {
    display: flex;
    gap: 2rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.role-filter,
.view-toggle,
.agent-filter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark);
    white-space: nowrap;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn,
.view-btn {
    padding: 0.4rem 0.75rem;
    background: var(--white);
    border: 2px solid var(--light-gray);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray);
    transition: all 0.3s ease;
}

.filter-btn:hover,
.view-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.filter-btn.active,
.view-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.legend {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--gray);
    white-space: nowrap;
}

.legend-icon {
    font-size: 1rem;
}

/* Agent Toggle */
.agent-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.agent-toggle input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    cursor: pointer;
    accent-color: var(--secondary);
}

.toggle-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark);
}

/* ======================
   MAIN CONTENT
   ====================== */

main {
    padding: 1rem 1rem 2rem 1rem;
    max-width: 1400px;
    margin: 0 auto;
}

.view-container {
    transition: opacity 0.3s ease;
}

.view-container.hidden {
    display: none;
}

/* ======================
   TIMELINE VIEW
   ====================== */

.sprint-container {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.week-indicators {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--light-gray);
}

.week-marker {
    flex: 1;
    text-align: center;
    padding: 0.75rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray);
    position: relative;
}

.week-marker::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.week-marker.week-0::after {
    right: 66.66%;
}

.week-marker.week-1::after {
    left: 33.33%;
    right: 33.33%;
}

.week-marker.week-2::after {
    left: 66.66%;
}

.timeline {
    position: relative;
    padding-left: 3rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, var(--primary), var(--secondary));
}

.timeline-item {
    position: relative;
    margin-bottom: 1.25rem;
    padding-left: 2.5rem;
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.timeline-item.phase {
    margin-bottom: 2rem;
    margin-top: 2.5rem;
    cursor: pointer;
}

.timeline-item.activity {
    margin-bottom: 1rem;
    padding-left: 4rem;
}

.timeline-item.hidden {
    display: none;
}

.timeline-item.child-item.collapsed {
    display: none;
}

.timeline-marker {
    position: absolute;
    left: -2.7rem;
    top: 0.25rem;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--white);
    border: 3px solid var(--primary);
    display: grid;
    place-items: center;
    font-size: 0.8rem;
    box-shadow: var(--shadow);
    z-index: 2;
}

.timeline-item.phase .timeline-marker {
    width: 2.5rem;
    height: 2.5rem;
    border-width: 4px;
    font-size: 1.2rem;
    background: var(--primary);
    left: -2.65rem;
    top: 0;
}

.timeline-item.has-ai-commands .timeline-marker {
    background: var(--ai-gradient);
    border-color: var(--secondary);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(0, 193, 197, 0.7);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(0, 193, 197, 0);
    }
}

.collapse-icon {
    display: inline-block;
    margin-right: 0.5rem;
    font-size: 0.9rem;
    transition: transform 0.3s ease;
    color: var(--primary);
}

.timeline-item.phase:not(.collapsed) .collapse-icon {
    transform: rotate(90deg);
}

.timeline-content {
    background: var(--bg);
    padding: 1rem 1.25rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.timeline-content:hover {
    transform: translateX(6px);
    box-shadow: var(--shadow-lg);
    border-left-color: var(--secondary);
}

.timeline-item.phase .timeline-content {
    background: linear-gradient(135deg, rgba(20, 69, 96, 0.12) 0%, rgba(32, 91, 121, 0.18) 100%);
    border-left-width: 6px;
    padding: 1.25rem 1.5rem;
}

.timeline-item.has-ai-commands .timeline-content {
    border-left-color: var(--secondary);
    background: linear-gradient(135deg, rgba(47, 243, 224, 0.08) 0%, rgba(0, 193, 197, 0.12) 100%);
}

.timeline-item.selected .timeline-content {
    border-left-color: var(--success);
    background: linear-gradient(135deg, rgba(46, 97, 42, 0.08) 0%, rgba(46, 97, 42, 0.15) 100%);
    box-shadow: 0 0 0 3px rgba(46, 97, 42, 0.3);
}

.timeline-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.timeline-item.phase .timeline-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

.timeline-description {
    color: var(--gray);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.timeline-roles {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.role-badge {
    background: var(--white);
    color: var(--primary);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 2px solid var(--primary);
}

.role-badge.pm {
    border-color: var(--role-pm);
    color: var(--role-pm);
}

.role-badge.dev {
    border-color: var(--role-dev);
    color: var(--role-dev);
}

.role-badge.lead-dev {
    border-color: var(--role-lead-dev);
    color: var(--role-lead-dev);
}

.role-badge.to {
    border-color: var(--role-to);
    color: var(--role-to);
}

.role-badge.cs {
    border-color: var(--role-cs);
    color: var(--role-cs);
}

.ai-badge {
    background: var(--ai-gradient);
    color: var(--white);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
}

.week-badge {
    background: var(--light-gray);
    color: var(--gray);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ======================
   COMMANDS VIEW
   ====================== */

.commands-container {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.commands-container h2 {
    color: var(--primary);
    margin-bottom: 2rem;
    font-size: 2rem;
}

#commandsGrid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.command-category h3 {
    color: var(--secondary);
    margin-bottom: 1rem;
    font-size: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--light-gray);
}

.commands-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.command-card {
    background: var(--bg);
    padding: 1.25rem;
    border-radius: 8px;
    border-left: 4px solid var(--secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.command-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-left-color: var(--primary);
}

.command-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
}

.command-name {
    font-weight: 700;
    color: var(--dark);
    font-size: 0.95rem;
}

.mcp-badge {
    background: var(--info);
    color: var(--white);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.command-description {
    color: var(--gray);
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.command-note {
    color: var(--warning);
    font-size: 0.75rem;
    font-style: italic;
    margin-top: 0.5rem;
}

/* ======================
   ROLES VIEW
   ====================== */

.roles-container {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.roles-container h2 {
    color: var(--primary);
    margin-bottom: 2rem;
    font-size: 2rem;
}

#rolesGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.role-card {
    background: var(--bg);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 6px solid var(--primary);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.role-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.role-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.role-badge-large {
    background: var(--primary);
    color: var(--white);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
}

.role-badge-large.pm {
    background: var(--role-pm);
}

.role-badge-large.dev {
    background: var(--role-dev);
}

.role-badge-large.lead-dev {
    background: var(--role-lead-dev);
}

.role-badge-large.to {
    background: var(--role-to);
}

.role-badge-large.cs {
    background: var(--role-cs);
}

.role-card h3 {
    color: var(--dark);
    font-size: 1.3rem;
}

.role-card h4 {
    color: var(--gray);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.role-responsibilities {
    list-style: none;
    padding-left: 0;
}

.role-responsibilities li {
    padding: 0.4rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--gray);
    font-size: 0.9rem;
}

.role-responsibilities li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}

/* ======================
   DETAIL PANEL
   ====================== */

.detail-panel {
    position: fixed;
    right: -550px;
    top: 0;
    width: 550px;
    height: 100vh;
    background: var(--white);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    padding: 2.5rem;
}

.detail-panel.open {
    right: 0;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--danger);
    color: var(--white);
    border: none;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.close-btn:hover {
    background: #dc2626;
    transform: rotate(90deg);
}

.detail-content h2 {
    color: var(--dark);
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.detail-content h3 {
    color: var(--primary);
    margin: 1.5rem 0 0.75rem;
    font-size: 1.3rem;
}

.detail-content h4 {
    color: var(--secondary);
    margin: 1rem 0 0.5rem;
    font-size: 1.1rem;
}

.detail-description {
    color: var(--gray);
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.detail-tasks,
.communication-rules ul {
    list-style: none;
    padding-left: 0;
}

.detail-tasks li,
.communication-rules li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--gray);
}

.detail-tasks li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

.communication-rules li::before {
    content: '•';
    position: absolute;
    left: 0.5rem;
    color: var(--info);
}

.ai-commands {
    background: var(--ai-gradient);
    padding: 1.5rem;
    border-radius: 12px;
    margin: 1.5rem 0;
}

.ai-commands h3 {
    color: var(--dark);
    margin-top: 0;
    font-weight: 700;
}

.command-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.command-item {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 1rem;
    border-radius: 8px;
    color: var(--dark);
    border: 2px solid rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.command-item:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateX(4px);
    border-color: var(--primary);
}

.command-item strong {
    display: block;
    margin-bottom: 0.25rem;
    font-family: 'Courier New', monospace;
}

.command-item p {
    font-size: 0.85rem;
    opacity: 0.9;
}

.result-box,
.note-box {
    background: var(--bg);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    border-left: 4px solid var(--success);
}

.note-box {
    border-left-color: var(--info);
}

.communication-rules {
    background: var(--bg);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    border-left: 4px solid var(--info);
}

.empty-state {
    text-align: center;
    color: var(--gray);
    padding: 3rem 1rem;
    font-style: italic;
}

/* ======================
   MODAL
   ====================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.open {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--white);
    padding: 2.5rem;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#commandModalContent h2 {
    color: var(--dark);
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

#commandModalContent h3 {
    color: var(--primary);
    margin: 1.5rem 0 0.75rem;
    font-size: 1.3rem;
}

.command-detail-section {
    margin-bottom: 1.5rem;
}

.command-detail-section p {
    color: var(--gray);
    font-size: 0.95rem;
    line-height: 1.6;
}

.mcp-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.mcp-badge-large {
    background: var(--info);
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}

.mcp-badge-large.available {
    background: var(--success);
}

.mcp-badge-large.limited {
    background: var(--warning);
}

.mcp-badge-large.planned {
    background: var(--gray);
}

/* ======================
   RESPONSIVE
   ====================== */

@media (max-width: 768px) {
    .header-content h1 {
        font-size: 1.2rem;
    }

    .controls {
        flex-direction: column;
        gap: 1rem;
    }

    .timeline {
        padding-left: 2rem;
    }

    .timeline::before {
        left: 0.5rem;
    }

    .timeline-marker {
        left: -1.75rem;
    }

    .timeline-item.phase .timeline-marker {
        left: -2rem;
    }

    .timeline-item.activity {
        padding-left: 3rem;
    }

    .detail-panel {
        width: 100%;
        right: -100%;
    }

    .commands-list {
        grid-template-columns: 1fr;
    }

    #rolesGrid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }
}

/* ======================
   UTILITIES
   ====================== */

html {
    scroll-behavior: smooth;
}

::selection {
    background: var(--primary);
    color: var(--white);
}
