:root {
    --bg-primary: #09090b;
    --bg-secondary: #18181b;
    --bg-tertiary: #27272a;
    --bg-elevated: #1c1c1f;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    --border: #3f3f46;
    --border-hover: #52525b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    --shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 4px 12px 0 rgba(0, 0, 0, 0.4);
    --shadow-card-hover: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 4px 8px 0 rgba(0, 0, 0, 0.4), 0 12px 28px 0 rgba(0, 0, 0, 0.5);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.header {
    background: rgba(24, 24, 27, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: var(--transition-base);
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-hover), transparent);
    opacity: 0;
    transition: var(--transition-base);
}

.header:hover::after {
    opacity: 1;
}

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

.logo {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo::before {
    content: '';
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: var(--radius-sm);
    display: inline-block;
    -webkit-text-fill-color: initial;
}

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

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 16px;
    padding-left: 40px;
    border-radius: var(--radius-md);
    width: 280px;
    font-size: 14px;
    font-family: var(--font-sans);
    transition: var(--transition-base);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2371717a'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
    background-size: 18px;
}

.search-input:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: var(--bg-elevated);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

.btn-icon {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 10px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-base);
    position: relative;
}

.btn-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    transition: var(--transition-base);
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.1), rgba(167, 139, 250, 0.1));
}

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

.btn-icon:hover::after {
    opacity: 1;
}

.btn-icon:active {
    transform: scale(0.96);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.btn-secondary {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 10px 18px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-sans);
    transition: var(--transition-base);
}

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

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: var(--font-sans);
    transition: var(--transition-base);
    box-shadow: var(--shadow-md), 0 0 0 1px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: var(--font-sans);
    transition: var(--transition-base);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition-base);
    line-height: 1;
}

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

.color-legend {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 16px 32px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
    animation: slideDown 200ms ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition-base);
}

.legend-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
}

.ai-panel {
    position: fixed;
    top: 80px;
    right: 32px;
    width: 360px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 200;
    animation: slideIn 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.ai-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-header h3 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.ai-content {
    padding: 20px;
    max-height: 450px;
    overflow-y: auto;
}

.ai-loading {
    color: var(--text-tertiary);
    text-align: center;
    padding: 40px 20px;
    font-size: 14px;
}

.ai-suggestion {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    border: 1px solid var(--border);
    transition: var(--transition-base);
}

.ai-suggestion:hover {
    border-color: var(--border-hover);
}

.ai-suggestion p {
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.6;
}

.ai-actions {
    display: flex;
    gap: 8px;
}

.ai-actions button {
    flex: 1;
    padding: 8px 14px;
    font-size: 13px;
}

.focus-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(9, 9, 11, 0.95);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    animation: fadeIn 300ms ease;
}

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

.focus-content {
    text-align: center;
    animation: zoomIn 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.focus-content h2 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.focus-content p {
    color: var(--text-secondary);
    font-size: 18px;
    margin-bottom: 8px;
}

.focus-timer {
    font-size: 96px;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin: 48px 0;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-variant-numeric: tabular-nums;
}

.focus-controls {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.board {
    display: flex;
    gap: 20px;
    padding: 32px;
    overflow-x: auto;
    min-height: calc(100vh - 130px);
    align-items: flex-start;
}

.board::-webkit-scrollbar {
    height: 8px;
}

.board::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

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

.board::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}

.column {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    min-width: 320px;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 180px);
    border: 1px solid var(--border);
    transition: var(--transition-base);
}

.column:hover {
    border-color: var(--border-hover);
}

.column-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 10;
}

.column-title {
    font-weight: 600;
    font-size: 14px;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.column-count {
    background: var(--bg-tertiary);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    min-width: 32px;
    text-align: center;
}

.column-limit-warning {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

.column-cards {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.column-cards::-webkit-scrollbar {
    width: 6px;
}

.column-cards::-webkit-scrollbar-track {
    background: transparent;
}

.column-cards::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.column-cards::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}

.column-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.add-card-btn {
    width: 100%;
    background: transparent;
    border: 1px dashed var(--border);
    color: var(--text-tertiary);
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-sans);
    transition: var(--transition-base);
}

.add-card-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

.card {
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: grab;
    transition: var(--transition-base);
    border: 1px solid transparent;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--card-color, #3b82f6);
    opacity: 1;
    transition: var(--transition-base);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
    border-color: rgba(255, 255, 255, 0.05);
}

.card:hover::before {
    opacity: 1;
}

.card.dragging {
    opacity: 0.5;
    cursor: grabbing;
    transform: rotate(3deg) scale(1.02);
}

.card-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.card-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-tertiary);
    gap: 8px;
}

.card-due {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.card-due.overdue {
    color: #f87171;
}

.card-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.tag {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(9, 9, 11, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 200ms ease;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
    animation: zoomIn 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

form {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 14px;
    transition: var(--transition-base);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.color-picker {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 4px 0;
}

.color-option {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition-spring);
    position: relative;
}

.color-option::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: var(--transition-base);
}

.color-option:hover {
    transform: scale(1.15);
}

.color-option.selected {
    border-color: white;
    transform: scale(1.1);
}

.color-option.selected::after {
    border-color: rgba(255, 255, 255, 0.2);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .board {
        flex-direction: column;
        padding: 20px;
    }

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

    .header {
        padding: 16px 20px;
        flex-wrap: wrap;
        gap: 12px;
    }

    .search-input {
        width: 100%;
    }

    .ai-panel {
        right: 16px;
        left: 16px;
        width: auto;
    }

    .focus-timer {
        font-size: 64px;
    }
}

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

.column-cards.drag-over {
    background: rgba(59, 130, 246, 0.05);
    border-radius: var(--radius-md);
}

.card:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.btn-icon:focus, .btn-secondary:focus, .btn-primary:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.add-card-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    z-index: 400;
    animation: slideUp 300ms ease;
}

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

.toast.success {
    border-left: 3px solid #10b981;
}

.toast.error {
    border-left: 3px solid #ef4444;
}

.column-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.board-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.board-actions button {
    flex: 1;
}

.column-cards.drag-over {
    background: rgba(59, 130, 246, 0.05);
    border-radius: var(--radius-md);
}

.card:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.btn-icon:focus, .btn-secondary:focus, .btn-primary:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.add-card-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    z-index: 400;
    animation: slideUp 300ms ease;
}

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

.toast.success {
    border-left: 3px solid #10b981;
}

.toast.error {
    border-left: 3px solid #ef4444;
}

.column-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.board-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.board-actions button {
    flex: 1;
}
