:root {
    --bg-deep: #020205;
    --bg-purple: #0a0a12;
    --bg-lighter: #11111a;
    --accent-cyan: #00f2ff;
    --accent-orange: #ff9900;
    --glass-bg: rgba(10, 10, 15, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #ffffff;
    --text-muted: #8899ac;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Rajdhani', sans-serif;
    background: linear-gradient(to right, var(--bg-deep), var(--bg-purple), var(--bg-lighter));
    color: var(--text-main);
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    font-weight: 500;
}

#bgCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.container {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
}

h1 {
    text-align: center;
    font-weight: 700;
    font-size: clamp(2.4rem, 7vw, 3.7rem);
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: #fdfdff;
    background: linear-gradient(120deg, var(--accent-cyan) 0%, #ffffff 45%, var(--accent-orange) 90%);
    background-size: 220% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 25px rgba(0, 242, 255, 0.25), 0 0 35px rgba(255, 153, 0, 0.15);
    animation: headingShift 12s linear infinite, headingGlow 6s ease-in-out infinite alternate;
}

@keyframes headingShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes headingGlow {
    0% { filter: drop-shadow(0 0 6px rgba(0, 242, 255, 0.3)); }
    100% { filter: drop-shadow(0 0 16px rgba(255, 153, 0, 0.35)); }
}

.card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.5);
}

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

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent-cyan);
    font-weight: 700;
}

input {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
    color: #fff;
    padding: 0.7rem;
    border-radius: 4px;
    width: 110px;
    text-align: center;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    outline: none;
    transition: 0.3s;
}

input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.3);
    background: rgba(0, 242, 255, 0.05);
}

input[readonly] {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    border: none;
}

button {
    padding: 0.7rem 1.8rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
    color: inherit;
}

button:focus-visible {
    outline: 2px solid var(--accent-orange);
    outline-offset: 2px;
}

.primary-btn {
    background: var(--accent-cyan);
    color: #000;
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.4);
}

.primary-btn:hover {
    background: #fff;
    box-shadow: 0 0 30px rgba(0, 242, 255, 0.7);
    transform: translateY(-2px);
}

.secondary-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.secondary-btn:hover {
    border-color: #fff;
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.danger-btn {
    border-color: #ff4444;
    color: #ff4444;
}

.danger-btn:hover {
    border-color: #ff9393;
    color: #ffb3b3;
    background: rgba(255, 68, 68, 0.1);
}

.table-card {
    padding: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 8px;
}

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

th {
    background: rgba(0, 0, 0, 0.6);
    color: var(--accent-cyan);
    text-transform: uppercase;
    font-size: 1rem;
    letter-spacing: 1px;
    font-weight: 700;
}

td {
    color: var(--text-main);
    font-size: 1.2rem;
    font-weight: 500;
}

.algo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}

.algo-header h3 {
    margin: 0;
    color: #fff;
    font-weight: 600;
    font-size: 1.8rem;
    letter-spacing: 1px;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ghost-btn {
    background: transparent;
    border: 1px solid var(--accent-cyan);
    color: var(--accent-cyan);
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 1px;
}

.ghost-btn:hover {
    background: rgba(0, 242, 255, 0.15);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.2);
}

.ai-btn {
    background: transparent;
    border: 1px solid var(--accent-orange);
    color: var(--accent-orange);
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 1px;
}

.ai-btn:hover {
    background: rgba(255, 153, 0, 0.15);
    box-shadow: 0 0 10px rgba(255, 153, 0, 0.2);
}

.gantt-chart {
    display: flex;
    height: 70px;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    position: relative;
    margin-bottom: 35px;
    border: 1px solid var(--glass-border);
    padding: 2px;
    gap: 2px;
}

.gantt-block {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-weight: 700;
    font-size: 1rem;
    position: relative;
    height: 100%;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.1);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    letter-spacing: 1px;
    z-index: 1;
    cursor: pointer;
}

.gantt-block:hover {
    transform: scale(1.15);
    z-index: 100;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
    border-radius: 4px;
}

.gantt-block.idle {
    background: repeating-linear-gradient(45deg, #1a1a1a, #1a1a1a 10px, #222 10px, #222 20px);
    color: #666;
}

.time-marker,
.start-marker {
    position: absolute;
    bottom: -30px;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
}

.time-marker {
    right: 0;
    transform: translateX(50%);
}

.start-marker {
    left: 0;
    transform: translateX(-50%);
}

.legend {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 5px 15px;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.color-box {
    width: 10px;
    height: 10px;
    border-radius: 0;
    transform: rotate(45deg);
}

.modal {
    display: none;
    position: fixed;
    z-index: 200;
    inset: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: #050505;
    border: 1px solid var(--accent-cyan);
    color: #fff;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 0 60px rgba(0, 242, 255, 0.15);
}

.modal-title {
    color: var(--accent-cyan);
    margin-top: 0;
    letter-spacing: 2px;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2.5rem;
    color: var(--accent-cyan);
    cursor: pointer;
    line-height: 0.8;
    background: none;
    border: none;
    padding: 0;
}

.close-btn:hover {
    color: #fff;
}

.log-entry {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px 0;
    font-size: 1.1rem;
}

.log-time {
    color: var(--accent-orange);
    font-weight: 700;
    margin-right: 10px;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    .controls {
        justify-content: flex-start;
    }

    input {
        width: 100%;
    }

    .algo-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
