@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #131a2a;
    --glass-bg: rgba(19, 26, 42, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.4);
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --idle-bg: repeating-linear-gradient(45deg, rgba(30, 41, 59, 0.4), rgba(30, 41, 59, 0.4) 10px, rgba(15, 23, 42, 0.4) 10px, rgba(15, 23, 42, 0.4) 20px);
    
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.12), transparent 30%),
        radial-gradient(circle at 85% 30%, rgba(236, 72, 153, 0.12), transparent 30%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 2rem 1rem;
}

/* Base styles / Containers */
.app-container {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Typography & Layout */
h1, h2, h3 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 0.5rem;
}

.logo h1 {
    font-size: 2.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(168, 85, 247, 0.4);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 300;
}

/* Cards & Glassmorphism */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.glass-panel:hover {
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Sections */
main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.4rem;
    color: var(--text-primary);
}

/* Controls */
.controls-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 200px;
}

.control-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.action-group {
    flex: 0 0 auto;
    justify-content: flex-end;
    flex-direction: row;
    align-items: flex-end;
}

.action-group button {
    height: 48px; /* Match input heights */
}

/* Inputs & Buttons */
.dropdown, .num-input {
    width: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

.dropdown:focus, .num-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.mini-input {
    padding: 0.4rem 0.5rem;
    width: 60px;
    font-size: 0.9rem;
    text-align: center;
}

.tq-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.tq-inline label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    outline: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.primary-btn {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

.primary-btn:hover {
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5);
    transform: translateY(-2px);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-hover);
    transform: scale(1.1);
}

/* Table */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--glass-border);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

th {
    background: rgba(15, 23, 42, 0.8);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tbody tr {
    transition: background 0.2s;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

td {
    color: var(--text-primary);
    vertical-align: middle;
}

tfoot {
    background: rgba(15, 23, 42, 0.6);
    font-weight: 600;
}

tfoot td {
    color: var(--accent);
}

.color-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    box-shadow: 0 0 8px currentColor;
}

.table-input {
    width: 80px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.4rem;
    border-radius: 4px;
    font-size: 0.95rem;
    text-align: center;
    transition: var(--transition);
}

.table-input:focus {
    border-color: var(--accent);
    outline: none;
}

/* Gantt Chart */
.output-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.cmp-header {
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

.gantt-chart-wrapper {
    margin-top: 0.5rem;
    position: relative;
    padding-bottom: 1.5rem; /* Space for ticks */
}

.gantt-chart {
    display: flex;
    height: 48px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.gantt-block {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    transition: width 0.3s ease, flex-grow 0.3s ease;
    border-right: 1px solid rgba(255,255,255,0.1);
    position: relative;
    overflow: hidden;
}

.gantt-block:last-child {
    border-right: none;
}

.gantt-block.idle {
    background: var(--idle-bg);
    color: var(--text-muted);
}

.gantt-block span {
    position: relative;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}

/* Glass shine on blocks */
.gantt-block::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 50%);
    pointer-events: none;
}

/* Interactive hover on block */
.gantt-block:hover::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: var(--bg-primary);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 10;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--glass-border);
    opacity: 0;
    animation: fadeInTooltip 0.2s forwards;
}

@keyframes fadeInTooltip {
    to { opacity: 1; transform: translateX(-50%) translateY(-4px); }
}

.gantt-ticks {
    display: flex;
    position: absolute;
    bottom: 0px;
    left: 0;
    right: 0;
    height: 20px;
}

.tick-mark {
    position: absolute;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tick-mark::before {
    content: '';
    width: 1px;
    height: 4px;
    background-color: var(--text-muted);
    margin-bottom: 2px;
}

/* Stacked Charts (Comparison Mode) */
.stacked-charts {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

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

.chart-label {
    width: 60px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: right;
    flex-shrink: 0;
}

.flex-col-label {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.chart-row .gantt-chart-wrapper {
    flex-grow: 1;
    margin-top: 0;
}

/* Animations Utility */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-style: italic;
    background: rgba(15, 23, 42, 0.4);
    border-radius: var(--radius-sm);
}

@media (max-width: 768px) {
    .controls-grid {
        flex-direction: column;
        align-items: stretch;
    }
    .chart-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    .chart-label, .flex-col-label {
        width: auto;
        text-align: left;
        align-items: flex-start;
    }
}
