/* =========================================
   Roadmap (Yol Haritası) — Obsidian Graph Theme
   ========================================= */

/* --- Page Container (overflow fix) --- */
#page-roadmap {
    overflow: hidden;
    max-width: 100%;
}

/* --- List View --- */
.roadmap-actions-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.roadmap-create-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}
.roadmap-create-btn svg {
    width: 16px;
    height: 16px;
}
.roadmap-create-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.15);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Roadmap Cards */
.roadmap-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.roadmap-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
.roadmap-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent);
    opacity: 0.6;
}
.roadmap-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: var(--card-shadow);
}

.roadmap-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.roadmap-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.roadmap-card-meta svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.roadmap-card-progress {
    width: 100%;
    height: 4px;
    background: var(--card-border);
    border-radius: 4px;
    overflow: hidden;
}
.roadmap-card-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.roadmap-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.roadmap-card-delete {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
}
.roadmap-card-delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}
.roadmap-card-delete svg {
    width: 14px;
    height: 14px;
}

/* Empty State */
.roadmap-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    position: relative;
}
.roadmap-empty svg {
    width: 56px;
    height: 56px;
    color: var(--accent);
    opacity: 0.4;
    margin-bottom: 16px;
}
.roadmap-empty h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 6px;
}
.roadmap-empty p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    max-width: 320px;
}

/* --- Graph View --- */
#roadmap-graph-view {
    position: relative;
    height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* TopBar */
.roadmap-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--card-border);
    z-index: 10;
    flex-shrink: 0;
}

.roadmap-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.roadmap-back-btn svg {
    width: 18px;
    height: 18px;
}
.roadmap-back-btn:hover {
    background: var(--sidebar-active-bg);
}

.roadmap-topbar-info {
    flex: 1;
    min-width: 0;
}
.roadmap-topbar-info h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.roadmap-topbar-info span {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.roadmap-topbar-progress {
    width: 100px;
    height: 4px;
    background: var(--card-border);
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}
.roadmap-topbar-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.roadmap-topbar-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.roadmap-topbar-actions button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.roadmap-topbar-actions button svg {
    width: 16px;
    height: 16px;
}
.roadmap-topbar-actions button:hover {
    color: var(--text-primary);
    background: var(--sidebar-active-bg);
}
.roadmap-delete-btn:hover {
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.1) !important;
}

/* Canvas Container */
.roadmap-canvas-container {
    flex: 1;
    position: relative;
    background: var(--body-bg);
    overflow: hidden;
}

.roadmap-canvas-container canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}
.roadmap-canvas-container canvas:active {
    cursor: grabbing;
}

/* Day Indicator */
.roadmap-day-indicator {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 10px 16px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    z-index: 5;
}
.day-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}
.day-number {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}
.day-total {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Zoom Controls */
.roadmap-zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 5;
}
.roadmap-zoom-controls button {
    width: 36px;
    height: 36px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.roadmap-zoom-controls button:first-child {
    border-radius: 10px 10px 0 0;
}
.roadmap-zoom-controls button:last-child {
    border-radius: 0 0 10px 10px;
}
.roadmap-zoom-controls button:hover {
    background: var(--sidebar-active-bg);
    color: var(--text-primary);
}

/* --- Side Panel --- */
.roadmap-side-panel {
    position: absolute;
    top: 0;
    right: -380px;
    width: 360px;
    height: 100%;
    background: var(--card-bg);
    border-left: 1px solid var(--card-border);
    z-index: 20;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.roadmap-side-panel.open {
    right: 0;
}

.roadmap-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--card-border);
}
.panel-node-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
    flex-shrink: 0;
}
.roadmap-panel-header h4 {
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.panel-close-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: var(--sidebar-active-bg);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.panel-close-btn svg {
    width: 16px;
    height: 16px;
}
.panel-close-btn:hover {
    color: var(--text-primary);
}

.roadmap-panel-body {
    padding: 16px 20px;
    flex: 1;
}

.panel-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.panel-badge {
    padding: 4px 10px;
    background: var(--sidebar-active-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 500;
}
.panel-status {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: auto;
}
.panel-status.waiting {
    background: var(--sidebar-active-bg);
    color: var(--text-secondary);
}
.panel-status.active {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}
.panel-status.completed {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}
.panel-status.locked {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.panel-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 18px;
}

.panel-section {
    margin-bottom: 18px;
}
.panel-section h5 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

/* Todos */
.panel-todo-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--card-border);
}
.panel-todo-check {
    width: 20px;
    height: 20px;
    border: 2px solid var(--card-border);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    color: transparent;
}
.panel-todo-check svg {
    width: 12px;
    height: 12px;
}
.panel-todo-check.checked {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.panel-todo-text {
    font-size: 0.85rem;
    color: var(--text-primary);
    flex: 1;
}
.panel-todo-text.done {
    text-decoration: line-through;
    opacity: 0.4;
}

/* Habits */
.panel-habit-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(168, 85, 247, 0.08);
    border: 1px solid rgba(168, 85, 247, 0.12);
    border-radius: 10px;
    margin-bottom: 6px;
    font-size: 0.82rem;
    color: #c084fc;
}
.panel-habit-item svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Complete Button */
.panel-complete-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: #10b981;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}
.panel-complete-btn svg {
    width: 18px;
    height: 18px;
}
.panel-complete-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}
.panel-complete-btn.completed {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    cursor: default;
    pointer-events: none;
}

/* --- Modal --- */
.roadmap-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.roadmap-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.roadmap-modal {
    width: 90%;
    max-width: 440px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    overflow: hidden;
    transform: translateY(20px) scale(0.96);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.roadmap-modal-overlay.active .roadmap-modal {
    transform: translateY(0) scale(1);
}

.roadmap-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--card-border);
}
.roadmap-modal-header h3 {
    font-size: 1.05rem;
    color: var(--text-primary);
}
.roadmap-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--sidebar-active-bg);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.roadmap-modal-close:hover {
    color: var(--text-primary);
}

.roadmap-modal-body {
    padding: 20px 24px 24px;
}

.roadmap-form-group {
    margin-bottom: 16px;
}
.roadmap-form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.roadmap-form-group textarea,
.roadmap-form-group input {
    width: 100%;
    padding: 10px 14px;
    background: var(--sidebar-active-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    resize: none;
    transition: border-color 0.2s;
}
.roadmap-form-group textarea:focus,
.roadmap-form-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.roadmap-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.roadmap-generate-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}
.roadmap-generate-btn svg {
    width: 18px;
    height: 18px;
}
.roadmap-generate-btn:hover {
    filter: brightness(1.15);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}
.roadmap-generate-btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Loading */
.roadmap-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 30px 0;
}
.roadmap-loading p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.roadmap-loading-orbit {
    position: relative;
    width: 50px;
    height: 50px;
}
.orbit-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}
.orbit-dot:nth-child(1) {
    animation: orbit 1.4s ease-in-out infinite;
}
.orbit-dot:nth-child(2) {
    animation: orbit 1.4s ease-in-out 0.2s infinite;
    opacity: 0.7;
}
.orbit-dot:nth-child(3) {
    animation: orbit 1.4s ease-in-out 0.4s infinite;
    opacity: 0.4;
}

@keyframes orbit {
    0%, 100% { top: 0; left: 50%; transform: translate(-50%, 0); }
    25% { top: 50%; left: 100%; transform: translate(-100%, -50%); }
    50% { top: 100%; left: 50%; transform: translate(-50%, -100%); }
    75% { top: 50%; left: 0; transform: translate(0, -50%); }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .roadmap-cards {
        grid-template-columns: 1fr;
    }
    .roadmap-side-panel {
        width: 100%;
        right: -100%;
    }
    .roadmap-topbar-info h3 {
        font-size: 0.9rem;
    }
    .roadmap-topbar-progress {
        display: none;
    }
    #roadmap-graph-view {
        height: calc(100vh - 48px);
    }
}
