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

/* Slide-specific CSS variables */
:root {
    --bg-dark: #0d0d1a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --accent-purple: #a855f7;
    --accent-pink: #ec4899;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --sidebar-accent: #3479FF;
    --sidebar-border: #EEEEEE;
}

/* Custom toggle icon stroke color */
.sidebar-toggle-btn .toggle-icon {
    stroke: white;
}

.section-header {
    font-size: 0.73125rem;
    font-weight: 700;
    color: var(--sidebar-accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
    padding-bottom: 2px;
    padding-left: 2px;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.graph-settings-section {
    padding: 8px 0;
}

/* Main content */
.main-content {
    padding: 0;
    overflow-y: auto;
    height: 100vh;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.sidebar .control-grid {
    grid-template-columns: 1fr;
    gap: 12px;
}

/* ==================== RANGE ROW (X/Y min-max inline) ==================== */

.range-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.range-row label {
    font-size: 0.71rem;
    font-weight: 700;
    color: #666666;
    min-width: 16px;
    flex-shrink: 0;
}

.range-row .number-input-wrapper {
    flex: 1;
    min-width: 0;
    width: auto;
}

.range-to {
    font-size: 0.7rem;
    color: #999;
    font-weight: 500;
    flex-shrink: 0;
}

/* ==================== GRAPH CONTAINER ==================== */

.graph-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.trig-graph-svg {
    width: 100%;
    height: auto;
    max-height: 90vh;
    display: block;
}

/* ==================== SVG GRAPH STYLES ==================== */

.grid-line {
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 1;
}

.grid-line-major {
    stroke: rgba(255, 255, 255, 0.12);
    stroke-width: 1;
}

.axis-line {
    stroke: rgba(255, 255, 255, 0.7);
    stroke-width: 2;
}

.axis-label {
    fill: rgba(255, 255, 255, 0.85);
    font-family: 'Poppins', sans-serif;
    font-size: 18px;
    font-weight: 500;
}

.tick-mark {
    stroke: rgba(255, 255, 255, 0.5);
    stroke-width: 1.5;
}

.function-curve {
    fill: none;
    stroke: var(--accent-purple);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.function-curve.animate-in {
    animation: curve-draw 0.6s ease-out forwards;
}

@keyframes curve-draw {
    from {
        stroke-dashoffset: var(--curve-length);
    }
    to {
        stroke-dashoffset: 0;
    }
}

/* ==================== DROPDOWN OVERRIDES ==================== */

.number-line-dropdown {
    width: 80px;
    flex-shrink: 0;
}

.number-line-dropdown.is-wide {
    width: 100%;
    flex: 1;
}

.number-line-trigger,
.number-line-dropdown .style-trigger {
    width: 100%;
    min-height: 44px;
    padding: 0 18px 0 8px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    position: relative;
    box-shadow: none;
    transform: none;
}

.sidebar .number-line-trigger,
.sidebar .number-line-dropdown .style-trigger {
    border: 2px solid var(--sidebar-border);
    background: #fafafa;
    color: #333;
}

.number-line-trigger::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid rgba(255, 255, 255, 0.6);
    transition: all 0.3s ease;
}

.sidebar .number-line-trigger::after {
    border-top-color: rgba(52, 121, 255, 0.8);
}

.number-line-trigger:hover,
.number-line-dropdown .style-trigger:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-purple);
    transform: none;
    box-shadow: none;
}

.sidebar .number-line-trigger:hover,
.sidebar .number-line-dropdown .style-trigger:hover {
    background: #fff;
    border-color: var(--sidebar-accent);
}

.number-line-dropdown.open .number-line-trigger,
.number-line-dropdown.open .style-trigger {
    border-color: var(--accent-purple);
    background: rgba(255, 255, 255, 0.08);
}

.sidebar .number-line-dropdown.open .number-line-trigger,
.sidebar .number-line-dropdown.open .style-trigger {
    border-color: var(--sidebar-accent);
    background: #fff;
}

.number-line-dropdown.open .number-line-trigger::after {
    border-top-color: var(--accent-purple);
    transform: translateY(-50%) rotate(180deg);
}

.number-line-menu,
.number-line-dropdown .style-menu {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: rgba(20, 20, 35, 0.98);
    border: 1px solid var(--accent-purple);
    border-radius: 10px;
    padding: 5px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(168, 85, 247, 0.3);
    backdrop-filter: blur(10px);
    flex-direction: column;
}

.sidebar .number-line-menu,
.sidebar .number-line-dropdown .style-menu {
    background: #fff;
    border: 1px solid var(--sidebar-accent);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.15);
}

.number-line-dropdown.open .number-line-menu,
.number-line-dropdown.open .style-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    display: flex;
}

.number-line-option,
.number-line-dropdown .style-option {
    padding: 10px;
    min-height: 42px;
    text-align: center;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 1.1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
}

.sidebar .number-line-option,
.sidebar .number-line-dropdown .style-option {
    color: #333;
}

.number-line-option:hover,
.number-line-dropdown .style-option:hover {
    background: rgba(168, 85, 247, 0.2);
}

.sidebar .number-line-option:hover,
.sidebar .number-line-dropdown .style-option:hover {
    background: #eef2ff;
}

.number-line-option.selected,
.number-line-dropdown .style-option.selected {
    background: rgba(168, 85, 247, 0.3);
    color: var(--accent-purple);
}

.sidebar .number-line-option.selected,
.sidebar .number-line-dropdown .style-option.selected {
    background: #e6efff;
    color: var(--sidebar-accent);
}

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

@media (max-width: 768px) {
    .control-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== SAVE FEATURE STYLES ==================== */
.saves-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 150px;
    overflow: hidden;
}

.sessions-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
    margin-top: 8px;
}

.sessions-list::-webkit-scrollbar {
    width: 6px;
}

.sessions-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.sessions-list::-webkit-scrollbar-thumb {
    background: rgba(51, 121, 255, 0.3);
    border-radius: 3px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 24px 16px;
    gap: 8px;
}

.empty-state svg {
    width: 40px;
    height: 40px;
    color: #CCCCCC;
    opacity: 0.5;
}

.empty-state span {
    font-size: 13px;
    color: #999999;
    text-align: center;
}

.session-tile {
    display: flex;
    align-items: center;
    padding: 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 12px;
}

.session-tile:hover {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.35);
}

.session-tile.active {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.5);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.1);
}

.session-thumbnail {
    width: 48px;
    height: 48px;
    background: #fff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid #eee;
}

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

.session-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.session-meta {
    font-size: 0.75rem;
    color: rgba(51, 51, 51, 0.5);
    display: flex;
    gap: 8px;
}

.session-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    flex-shrink: 0;
    position: relative;
}

.session-tile:hover .session-actions {
    opacity: 1;
}

.session-menu-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.06);
    border: none;
    border-radius: 4px;
    color: rgba(51, 51, 51, 0.6);
    cursor: pointer;
    transition: all 0.2s;
}

.session-menu-btn:hover {
    background: rgba(0, 0, 0, 0.14);
    color: #111111;
}

.session-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    display: none;
    flex-direction: column;
    gap: 2px;
    min-width: 150px;
    padding: 6px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
    z-index: 5;
}

.session-menu.open {
    display: flex;
}

.session-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 0.75rem;
    color: #333333;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s ease, color 0.2s ease;
}

.session-menu-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

.session-menu-item.remove {
    color: #ef4444;
}

.session-menu-item.remove:hover {
    background: rgba(239, 68, 68, 0.12);
}

.session-tile.is-hidden {
    opacity: 0.5;
}

.session-tile.is-hidden .session-thumbnail {
    filter: grayscale(0.4);
}

.save-button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--sidebar-accent) 0%, #2563eb 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(52, 121, 255, 0.3);
    margin-top: auto;
}

.save-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(52, 121, 255, 0.4);
    filter: brightness(1.1);
}

.save-button svg path,
.save-button svg polyline {
    stroke: white;
}

.save-button:active {
    transform: translateY(0);
}

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

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    width: 90%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.2s ease;
    overflow: hidden;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-overlay.visible .modal-dialog {
    transform: scale(1) translateY(0);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #333333;
    margin: 0;
}

.modal-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #E0E0E0;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    color: #333333;
    background: #FFFFFF;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.modal-input:focus {
    outline: none;
    border-color: var(--sidebar-accent);
    box-shadow: 0 0 0 3px rgba(52, 121, 255, 0.15);
}

.modal-input::placeholder {
    color: #999999;
}

.modal-message {
    font-size: 14px;
    color: #666666;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 4px;
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.modal-btn-cancel {
    background: #F5F5F5;
    color: #666666;
}

.modal-btn-cancel:hover {
    background: #E8E8E8;
}

.modal-btn-confirm {
    background: linear-gradient(135deg, var(--sidebar-accent) 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(52, 121, 255, 0.3);
}

.modal-btn-confirm:hover {
    box-shadow: 0 4px 12px rgba(52, 121, 255, 0.4);
    transform: translateY(-1px);
}

.modal-btn-danger {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.modal-btn-danger:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

/* ==================== GRAPH LAYERS ==================== */

.layers-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.layers-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.layers-list::-webkit-scrollbar {
    width: 4px;
}

.layers-list::-webkit-scrollbar-track {
    background: transparent;
}

.layers-list::-webkit-scrollbar-thumb {
    background: rgba(51, 121, 255, 0.2);
    border-radius: 2px;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    background: rgba(0, 0, 0, 0.03);
}

.layer-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

.layer-item.active {
    background: rgba(52, 121, 255, 0.08);
    border-color: rgba(52, 121, 255, 0.3);
}

.layer-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8), 0 1px 3px rgba(0, 0, 0, 0.15);
}

.layer-label {
    flex: 1;
    min-width: 0;
    font-family: 'Times New Roman', 'Georgia', serif;
    font-size: 0.85rem;
    font-style: italic;
    color: #444;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.layer-remove-btn {
    width: 22px;
    height: 22px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #999;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    opacity: 0;
}

.layer-item:hover .layer-remove-btn {
    opacity: 1;
}

.layer-remove-btn:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.add-graph-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: 1.5px dashed rgba(52, 121, 255, 0.3);
    border-radius: 8px;
    color: var(--sidebar-accent);
    font-family: 'Poppins', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.add-graph-button:hover {
    background: rgba(52, 121, 255, 0.06);
    border-color: rgba(52, 121, 255, 0.5);
}
