/* DevProductivity Custom Styles */

:root {
    --dp-primary: #1976D2;
    --dp-primary-dark: #1565C0;
    --dp-secondary: #424242;
    --dp-background: #121212;
    --dp-surface: #1E1E1E;
    --dp-surface-light: #2D2D2D;
    --dp-text-primary: rgba(255, 255, 255, 0.87);
    --dp-text-secondary: rgba(255, 255, 255, 0.60);
    --dp-text-disabled: rgba(255, 255, 255, 0.38);
    --dp-success: #4CAF50;
    --dp-warning: #FF9800;
    --dp-error: #F44336;
    --dp-info: #2196F3;
    --font-mono: 'JetBrains Mono', monospace;
}

/* Global */
html, body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    height: 100%;
    background-color: var(--dp-background);
    color: var(--dp-text-primary);
}

#app {
    height: 100%;
}

.loading-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #121212;
    color: #fff;
}

.loading-content {
    text-align: center;
}

.loading-logo {
    margin-bottom: 20px;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #b32121;
    color: white;
    padding: 1rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

.wasm-error-panel {
    align-items: center;
    display: flex;
    flex-direction: column;
    height: 100vh;
    justify-content: center;
    padding: 20px;
    text-align: center;
}

.wasm-error-panel button {
    background: #1976d2;
    border: 0;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    padding: 12px 24px;
}

/* Form validation */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

/* Code blocks */
code, pre, .code {
    font-family: var(--font-mono);
}

code {
    color: #c02d76;
}

/* Timeline styles (for TimeTagger-style view) */
.timeline-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

.timeline-svg {
    display: block;
}

.timeline-hour-line {
    stroke: var(--dp-surface-light);
    stroke-width: 1;
}

.timeline-hour-text {
    fill: var(--dp-text-secondary);
    font-size: 12px;
    font-family: 'Roboto', sans-serif;
}

.timeline-entry {
    cursor: pointer;
    transition: opacity 0.2s;
}

.timeline-entry:hover {
    opacity: 0.85;
}

.timeline-entry-rect {
    rx: 4;
    ry: 4;
}

.timeline-entry-text {
    fill: white;
    font-size: 11px;
    font-family: 'Roboto', sans-serif;
    pointer-events: none;
}

.timeline-current-time {
    stroke: var(--dp-error);
    stroke-width: 2;
}

/* Pomodoro Timer */
.pomodoro-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.pomodoro-circle {
    position: relative;
    width: 280px;
    height: 280px;
}

/* The SVG carries width/height attributes of 280; without this it ignores the
   responsive sizes below and overflows narrow viewports. */
.pomodoro-circle svg {
    transform: rotate(-90deg);
    display: block;
    width: 100%;
    height: 100%;
}

.pomodoro-progress-bg {
    fill: none;
    stroke: var(--dp-surface-light);
    stroke-width: 8;
}

.pomodoro-progress {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}

.pomodoro-progress.work {
    stroke: var(--dp-error);
}

.pomodoro-progress.break {
    stroke: var(--dp-success);
}

.pomodoro-time {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3.5rem;
    font-weight: 300;
    font-family: var(--font-mono);
}

.pomodoro-controls {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Kanban Board */
.kanban-board {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    height: calc(100vh - 150px);
    overflow-x: auto;
}

.kanban-column-header {
    padding: 1rem;
    font-weight: 500;
    border-bottom: 1px solid var(--dp-surface-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kanban-column-content {
    flex: 1;
    padding: 0.5rem;
    overflow-y: auto;
    min-height: 100px;
    transition: background-color 0.2s ease;
}

.kanban-column-content.drag-over {
    background-color: rgba(var(--mud-palette-primary-rgb), 0.05);
}

.kanban-card {
    background: var(--dp-surface-light);
    border-radius: 6px;
    padding: 0.75rem;
    cursor: grab;
    transition: transform 0.1s, box-shadow 0.1s, opacity 0.2s;
}

.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.kanban-card.dragging {
    opacity: 0.3;
    cursor: grabbing;
    transform: scale(0.98);
}

.kanban-card-wrapper {
    position: relative;
    margin-bottom: 0.5rem;
}

/* Drop indicator - shows exactly where the card will be placed */
.kanban-drop-indicator {
    margin-bottom: 0.5rem;
    animation: dropIndicatorFade 0.2s ease-out;
}

@keyframes dropIndicatorFade {
    from { opacity: 0; transform: scaleY(0.8); }
    to { opacity: 1; transform: scaleY(1); }
}

.kanban-drop-indicator-line {
    height: 3px;
    background: var(--mud-palette-primary);
    border-radius: 2px;
    margin-bottom: 4px;
    box-shadow: 0 0 8px var(--mud-palette-primary);
}

.kanban-ghost-card {
    background: var(--mud-palette-primary);
    border-radius: 6px;
    padding: 0.75rem;
    opacity: 0.7;
    border: 2px dashed var(--mud-palette-primary-darken);
}

.kanban-ghost-card .kanban-card-title {
    color: white;
    margin-bottom: 0;
}

/* Empty column drop zone */
.kanban-empty-drop-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    border: 2px dashed var(--dp-surface-light);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.kanban-empty-drop-zone.active {
    border-color: var(--mud-palette-primary);
    background: rgba(var(--mud-palette-primary-rgb), 0.1);
}

/* Column drag styles */
.kanban-column {
    flex: 0 0 320px;
    background: var(--dp-surface);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    max-height: 100%;
    transition: transform 0.2s ease, opacity 0.2s ease, border 0.2s ease;
    border: 2px solid transparent;
}

.kanban-column.dragging {
    opacity: 0.5;
    cursor: grabbing;
    transform: scale(0.98);
}

.kanban-column.drop-target {
    border: 2px dashed var(--mud-palette-primary);
    background: rgba(var(--mud-palette-primary-rgb), 0.05);
}

.kanban-column-header .drag-handle:hover {
    opacity: 1 !important;
    cursor: grab;
}

.kanban-card-title {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.kanban-card-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.kanban-label {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
}

/* Code Snippet Editor */
.snippet-editor {
    border-radius: 8px;
    overflow: hidden;
    background: var(--dp-surface);
}

.snippet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--dp-surface-light);
}

.snippet-language {
    font-size: 12px;
    color: var(--dp-text-secondary);
    text-transform: uppercase;
}

/* Note Editor */
.note-editor {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.note-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

/* Bookmark Card */
.bookmark-card {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--dp-surface);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: background-color 0.2s;
}

.bookmark-card:hover {
    background: var(--dp-surface-light);
}

.bookmark-favicon {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: var(--dp-surface-light);
}

.bookmark-info {
    flex: 1;
    overflow: hidden;
}

.bookmark-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bookmark-url {
    font-size: 12px;
    color: var(--dp-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Reminder Quick Add */
.reminder-quick-add {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--dp-surface);
    border-radius: 8px;
}

.reminder-quick-add input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--dp-text-primary);
    font-size: 1rem;
    outline: none;
}

.reminder-quick-add input::placeholder {
    color: var(--dp-text-disabled);
}

/* Project Selector */
.project-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.project-selector:hover {
    background: var(--dp-surface-light);
}

.project-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* Scrollbars (Webkit) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--dp-surface-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* Drawer entries that act rather than navigate are buttons, so they need the browser
   defaults cleared to sit flush with their MudNavLink siblings. */
.nav-link-button {
    background: none;
    border: 0;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    text-align: left;
    width: 100%;
    cursor: pointer;
}

/* Filter and search controls inside wrapping header rows. */
.filter-control {
    min-width: 200px;
    flex: 1 1 200px;
}

.filter-control-narrow {
    min-width: 150px;
    flex: 0 1 150px;
}

.filter-control-wide {
    min-width: 260px;
    flex: 1 1 260px;
}

/* Notes master/detail panes. Below md they stack, so the fixed height is dropped. */
.notes-list-pane,
.notes-editor-pane {
    height: calc(100vh - 150px);
}

.notes-list-pane {
    overflow-y: auto;
}

/* Report dialog label column and the controls it labels. */
.report-label {
    min-width: 120px;
    text-align: right;
}

.report-control {
    max-width: 280px;
    flex: 1 1 220px;
}

.report-record-duration {
    min-width: 50px;
}

.report-record-date {
    min-width: 90px;
}

/* Responsive */
@media (max-width: 959.95px) {
    .notes-list-pane,
    .notes-editor-pane {
        height: auto;
        max-height: none;
    }

    .notes-list-pane {
        max-height: 60vh;
    }
}

@media (max-width: 768px) {
    .kanban-board {
        flex-direction: column;
        height: auto;
    }

    .kanban-column {
        flex: none;
        width: 100%;
        max-height: 400px;
    }

    .pomodoro-circle {
        width: 200px;
        height: 200px;
    }

    .pomodoro-time {
        font-size: 2.5rem;
    }
}

@media (max-width: 599.95px) {
    .filter-control,
    .filter-control-narrow,
    .filter-control-wide {
        min-width: 0;
        flex: 1 1 100%;
        width: 100%;
    }

    .report-label {
        min-width: 0;
        text-align: left;
    }

    .report-control {
        max-width: none;
        flex: 1 1 100%;
        width: 100%;
    }

    .report-record-duration,
    .report-record-date {
        min-width: 0;
    }
}

@media (max-width: 360px) {
    .pomodoro-circle {
        width: 160px;
        height: 160px;
    }

    .pomodoro-time {
        font-size: 2rem;
    }
}

/* Mnemonic display */
.mnemonic-display {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    padding: 1rem;
    background: var(--dp-surface);
    border-radius: 8px;
    font-family: var(--font-mono);
}

.mnemonic-word {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--dp-surface-light);
    border-radius: 4px;
}

.mnemonic-word-index {
    font-size: 10px;
    color: var(--dp-text-secondary);
    min-width: 20px;
}

.mnemonic-word-text {
    font-weight: 500;
}

/* Reports / Charts */
.chart-container {
    background: var(--dp-surface);
    border-radius: 8px;
    padding: 1rem;
}

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

.stat-card {
    background: var(--dp-surface);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--dp-primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--dp-text-secondary);
    margin-top: 0.5rem;
}

/* Error UI */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHRleHQgeD0iMjgiIHk9IjI1IiBmb250LWZhbWlseT0ic2Fucy1zZXJpZiIgZm9udC1zaXplPSIyMCIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZG9taW5hbnQtYmFzZWxpbmU9Im1pZGRsZSI+8J+UpTwvdGV4dD48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* Form floating placeholders */
.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}
