/* ============================================================
   Dashboard Personal — Dark Mode Theme
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-card: #222638;
    --bg-input: #2a2e3f;
    --bg-hover: #2f3449;
    --bg-drag-over: #343a5c;

    --text-primary: #e4e6f0;
    --text-secondary: #9ca3b8;
    --text-muted: #6b7280;

    --accent-blue: #60a5fa;
    --accent-green: #34d399;
    --accent-purple: #a78bfa;
    --accent-orange: #fb923c;
    --accent-red: #f87171;
    --accent-yellow: #fbbf24;

    --border-color: #2d3148;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-xs: 6px;

    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-modal: 0 8px 40px rgba(0, 0, 0, 0.5);

    --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --transition: 0.2s ease;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* --- Utility --- */
.hidden {
    display: none !important;
}

/* --- Overlay / Login --- */
.overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-modal);
    text-align: center;
}

.login-box h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xs);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.error-msg {
    color: var(--accent-red);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    text-align: center;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--border-radius-xs);
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-blue);
    color: #fff;
}

.btn-primary:hover {
    background: #4f92e8;
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--accent-red);
    color: #fff;
}

.btn-danger:hover {
    background: #e05a5a;
}

.btn-icon {
    padding: 0.4rem 0.55rem;
    font-size: 1.1rem;
    background: var(--bg-input);
    color: var(--text-secondary);
    border-radius: var(--border-radius-xs);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-small {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
}

/* --- Header --- */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-blue);
}

.header-left {
    display: flex;
    align-items: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-greeting {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* --- Widget Grid --- */
.widget-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    padding: 1.5rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* --- Widget Card --- */
.widget {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Semantic widget selectors (inherit .widget styles) */
.weather-widget,
.tasks-widget,
.meeting-widget,
.haiku-widget {
    /* Inherits from .widget; semantic hooks for JS targeting */
}

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--border-color);
}

.widget-header h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.widget-body {
    padding: 1rem 1.1rem;
    flex: 1;
}

/* --- Weather Widget --- */
.weather-main {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.weather-icon {
    font-size: 3rem;
    line-height: 1;
}

.weather-temp {
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1.1;
}

.weather-condition {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: capitalize;
}

.weather-details {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.weather-detail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.weather-detail span:last-child {
    color: var(--text-secondary);
    font-weight: 600;
}

.weather-loading,
.weather-error {
    text-align: center;
    color: var(--text-muted);
    padding: 1.5rem 0;
    font-size: 0.9rem;
}

/* --- Tasks Widget --- */
.add-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.add-form input {
    flex: 1;
    padding: 0.5rem 0.7rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xs);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
}

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

.task-list {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
}

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

.task-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.88rem;
}

.task-item:last-child {
    border-bottom: none;
}

.task-checkbox {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    transition: all var(--transition);
}

.task-checkbox:checked {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.task-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.task-text {
    flex: 1;
    line-height: 1.3;
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    transition: all var(--transition);
    flex-shrink: 0;
}

.task-delete:hover {
    color: var(--accent-red);
    background: rgba(248, 113, 113, 0.1);
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 1.5rem 0;
}

/* --- Meeting Widget --- */
.meeting-info {
    text-align: center;
    padding: 0.5rem 0;
}

.meeting-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.meeting-datetime {
    color: var(--accent-blue);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.meeting-countdown {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.meeting-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.75rem;
}

/* --- Haiku Widget --- */
.haiku-text {
    text-align: center;
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    padding: 0.5rem 0;
}

.haiku-author {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.haiku-loading {
    text-align: center;
    color: var(--text-muted);
    padding: 1.5rem 0;
    font-size: 0.9rem;
}

/* --- Kanban Section --- */
.kanban-section {
    padding: 0 2rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.kanban-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-top: 1rem;
}

.kanban-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
}

.kanban-board {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    min-height: 300px;
}

.kanban-board::-webkit-scrollbar {
    height: 6px;
}

.kanban-board::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.kanban-column {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    min-width: 280px;
    max-width: 320px;
    flex: 1;
    display: flex;
    flex-direction: column;
    max-height: 500px;
    transition: border-color var(--transition);
}

.kanban-column.drag-over {
    border-color: var(--accent-blue);
    background: var(--bg-drag-over);
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.kanban-column-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
}

.kanban-column-title:hover {
    color: var(--accent-blue);
}

.kanban-column-count {
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    margin-left: 0.5rem;
}

.kanban-column-actions {
    display: flex;
    gap: 0.25rem;
}

.kanban-column-body {
    padding: 0.75rem;
    flex: 1;
    overflow-y: auto;
    min-height: 60px;
}

.kanban-column-body::-webkit-scrollbar {
    width: 4px;
}

.kanban-column-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.kanban-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    cursor: grab;
    transition: all var(--transition);
    user-select: none;
}

.kanban-card:hover {
    border-color: var(--accent-blue);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.kanban-card-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.kanban-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.25rem;
    margin-top: 0.4rem;
}

.kanban-card-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    transition: all var(--transition);
}

.kanban-card-delete:hover {
    color: var(--accent-red);
    background: rgba(248, 113, 113, 0.1);
}

.add-card-form {
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--border-color);
}

.add-card-form input {
    width: 100%;
    padding: 0.5rem 0.65rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xs);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
}

.add-card-form input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.kanban-loading {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 0;
    width: 100%;
    font-size: 0.9rem;
}

/* --- Modal --- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-modal);
    z-index: 1;
}

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

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .widget-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0.85rem 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .widget-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1rem;
    }

    .kanban-section {
        padding: 0 1rem 1rem;
    }

    .kanban-board {
        flex-direction: column;
    }

    .kanban-column {
        min-width: 100%;
        max-width: 100%;
        max-height: none;
    }

    .login-box {
        margin: 1rem;
        padding: 2rem 1.5rem;
    }

    .modal-content {
        margin: 1rem;
        padding: 1.25rem;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.1rem;
    }

    .weather-temp {
        font-size: 2rem;
    }

    .weather-icon {
        font-size: 2.5rem;
    }
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.widget {
    animation: fadeIn 0.3s ease forwards;
}

.widget:nth-child(2) { animation-delay: 0.05s; }
.widget:nth-child(3) { animation-delay: 0.1s; }
.widget:nth-child(4) { animation-delay: 0.15s; }
