@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
    --primary: #f7b731;
    --primary-dark: #eb9b00;
    --accent: #4ecdc4;
    --bg-dark: #0f172a;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --radius-bubble: 32px 32px 32px 10px;
    --radius-pill: 50px;
    --radius-sm: 16px;
    --shadow-premium: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
    --ease-in-out-back: cubic-bezier(0.68, -0.6, 0.32, 1.6);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #0b0f19;
    color: white;
    min-height: 100vh;
    overflow-x: hidden;
}

body.global-dragging,
body.global-dragging * {
    cursor: move !important;
    user-select: none !important;
}

/* Background Animated Shapes */
.bg-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.shape {
    position: absolute;
    filter: blur(80px);
    border-radius: 50%;
    opacity: 0.3;
}

.shape-1 {
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, #4f46e5, #0ea5e9);
    top: -200px;
    right: -100px;
    animation: floating 25s infinite alternate var(--ease-smooth);
}

.shape-2 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #f7b731, #f59e0b);
    bottom: -100px;
    left: -50px;
    animation: floating 20s infinite alternate-reverse var(--ease-smooth);
    animation-delay: -7s;
}

@keyframes floating {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    100% {
        transform: translate(150px, 100px) rotate(45deg);
    }
}

/* Auth Section */
#authSection {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 40px;
    padding: 48px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-premium);
    animation: modalIn 0.8s var(--ease-out-expo);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-card h1 {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

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

.auth-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    padding: 16px 24px;
    border-radius: 20px;
    color: white;
    outline: none;
    transition: all 0.4s var(--ease-smooth);
    font-size: 1rem;
}

.auth-input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.btn-primary {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 20px;
    color: #0f172a;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s var(--ease-smooth);
    box-shadow: 0 10px 25px rgba(247, 183, 49, 0.3);
}

.btn-primary:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 15px 35px rgba(247, 183, 49, 0.5);
}

/* Main Dashboard */
#appMain {
    display: none;
    padding: 40px 20px;
    max-width: 1500px;
    margin: 0 auto;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 50px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px);
    padding: 18px 32px;
    border-radius: 60px;
    border: 1px solid var(--glass-border);
}

.logo-area h2 {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.logo-area span {
    color: var(--primary);
}

/* Project Nav Tabs */
.project-nav {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-grow: 1;
    margin: 0 40px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 15px;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
}

.project-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: none;
    max-width: 600px;
}

.project-tabs::-webkit-scrollbar {
    display: none;
}

.project-tab {
    padding: 10px 24px;
    background: transparent;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s var(--ease-smooth);
    white-space: nowrap;
    color: #94a3b8;
    border: 1.5px solid transparent;
}

.project-tab.active {
    background: var(--primary);
    color: #0f172a;
    box-shadow: 0 10px 20px rgba(247, 183, 49, 0.2);
}

.project-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.btn-add-mini {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    color: #0f172a;
    cursor: pointer;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    font-weight: 900;
    flex-shrink: 0;
}

.btn-add-mini:hover {
    transform: scale(1.1) rotate(90deg);
}

/* Dashboard Summary Stats */
.dashboard-summary {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    padding: 24px 32px;
    border-radius: 32px;
    border: 1px solid var(--glass-border);
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 100px;
    height: 100px;
    background: var(--primary);
    filter: blur(60px);
    opacity: 0.1;
}

.stat-card span {
    font-size: 0.85rem;
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.stat-card h3 {
    font-size: 2.2rem;
    font-weight: 800;
    color: white;
}

.stat-card.highlight h3 {
    color: var(--primary);
    text-shadow: 0 0 20px rgba(247, 183, 49, 0.3);
}

.active-project-name {
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: -1.5px;
    margin: 0;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.search-input-header:focus {
    width: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: white;
    padding: 10px 24px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s var(--ease-smooth);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.btn-add {
    background: linear-gradient(135deg, white, #f1f5f9);
    color: #0f172a;
    border: none;
    padding: 14px 28px;
    border-radius: 40px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.4s var(--ease-smooth);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.btn-add:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.notes-grid {
    position: relative;
    width: 100%;
    min-height: 2000px;
    /* Large canvas for moving cards */
    margin-top: 30px;
    background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    /* Subtle grid pattern */
}

/* Sticky Card - Draggable & Scalable */
.sticky-card {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: transform 0.3s var(--ease-smooth), opacity 0.3s ease;
    width: 320px;
    height: 350px;
    /* Essential for dragging */
    resize: both;
    overflow: hidden;
    animation: fadeInMinimal 0.3s ease;
    z-index: 10;
    user-select: none;
}

.card-badge {
    position: absolute;
    top: -10px;
    left: -10px;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 900;
    font-size: 1.2rem;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
    z-index: 150;
    border: 3px solid #fff;
    transform: rotate(-10deg);
}

.progress-top-track {
    height: 6px;
    width: 100%;
    background: rgba(0, 0, 0, 0.05);
    overflow: hidden;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 100;
}

.progress-top-track .progress-bar {
    height: 100%;
    background: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
    transition: width 0.4s var(--ease-smooth);
}

.edit-patch {
    padding: 6px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 100px;
    font-size: 0.65rem;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    pointer-events: none;
    white-space: nowrap;
    align-self: flex-start;
    margin-top: 4px;
}

.sticky-card:not(.is-locked) {
    cursor: move;
    box-shadow: 0 0 0 5px var(--primary), 0 30px 60px rgba(0, 0, 0, 0.4);
    transform: scale(1.02);
    z-index: 1000;
}

.sticky-card:not(.is-locked) .card-body,
.sticky-card:not(.is-locked) .card-footer,
.sticky-card:not(.is-locked) .add-task-form {
    pointer-events: none;
    /* Disable internal clicks in move mode */
    opacity: 0.6;
    filter: grayscale(0.5);
}

.sticky-card.is-complete {
    border: 3px solid #10b981;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.15);
}

.sticky-card.is-complete .card-header {
    background: #ecfdf5;
}

.sticky-card.resizing {
    transition: none !important;
    /* Disable transitions while active resizing to prevent lag */
    z-index: 1001;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
}

.sticky-card:active {
    z-index: 1000;
}

@keyframes fadeInMinimal {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.sticky-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.12);
}

.card-header {
    padding: 12px 20px;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px dashed #f1f5f9;
    /* Drag handle indicator */
    user-select: none;
    gap: 10px;
}

.header-main-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.top-points-counter {
    background: #f1f5f9;
    color: #475569;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
    border: 1px solid #e2e8f0;
    margin-right: 15px;
}

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

.btn-lock {
    background: #f1f5f9;
    border: none;
    color: #475569;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s var(--ease-smooth);
    font-size: 0.9rem;
}

.btn-lock:hover {
    background: #e2e8f0;
}

.is-locked .btn-lock {
    background: var(--primary);
    color: #0f172a;
}

.title-group {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-title-input {
    border: none;
    background: transparent;
    font-weight: 800;
    font-size: 1.15rem;
    color: #0f172a;
    padding-left: 45px;
    /* Room for #Badge */
    padding-right: 10px;
    /* Room for Edit Patch */
    width: 100%;
    outline: none;
    letter-spacing: -0.5px;
    font-family: inherit;
    transition: background 0.3s ease;
    border-radius: 8px;
}

.card-title-input:focus {
    background: rgba(15, 23, 42, 0.03);
}

.card-date {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 600;
    margin-top: 2px;
    padding-left: 45px;
    /* Stay aligned with name */
}

.card-body {
    padding: 20px;
    flex-grow: 1;
    overflow-y: auto;
}

.date-group-header {
    font-size: 0.75rem;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 25px 0 15px 5px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-group-header::before {
    content: '📅';
    font-size: 0.8rem;
}

.date-group-header:first-child {
    margin-top: 5px;
}

.task-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
    background: white;
    padding: 16px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border-left: 4px solid transparent;
}

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

.task-image {
    max-width: 100%;
    border-radius: 12px;
    margin-top: 5px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    cursor: zoom-in;
}

.task-date {
    font-size: 0.7rem;
    color: #cbd5e1;
    margin-left: auto;
}

.task-item:hover {
    border-color: var(--primary);
    background: #fffdf5;
}

.task-check {
    width: 22px;
    height: 22px;
    accent-color: var(--primary);
    cursor: pointer;
    transition: 0.2s;
}

.task-check:checked {
    transform: scale(1.1);
}

.task-text {
    font-size: 1rem;
    font-weight: 500;
    color: #334155;
    flex-grow: 1;
}

.task-text.completed {
    text-decoration: line-through;
    color: #94a3b8;
    opacity: 0.7;
}

.progress-top-track {
    height: 6px;
    width: 100%;
    background: rgba(0, 0, 0, 0.05);
    overflow: hidden;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 100;
}

.progress-top-track .progress-bar {
    height: 100%;
    background: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    transition: width 0.4s var(--ease-smooth);
}

.card-footer {
    padding: 8px 24px;
    background: rgba(241, 245, 249, 0.5);
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: center;
}

.progress-num {
    font-size: 0.75rem;
    font-weight: 700;
    color: #334155;
}

.add-task-form {
    padding: 10px 24px 20px 24px;
    background: #fff;
    border-top: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Chat-style Textarea Box */
.add-task-form {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
}

.input-container {
    position: relative;
}

.task-textarea {
    width: 100%;
    min-height: 80px;
    max-height: 200px;
    border: 2px solid #e2e8f0;
    padding: 15px;
    border-radius: 15px;
    outline: none;
    font-size: 0.95rem;
    background: white;
    resize: none;
    transition: 0.3s;
}

.auth-switch {
    margin-top: 25px;
}

#toggleAuth {
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s var(--ease-smooth);
    display: inline-block;
    opacity: 0.8;
}

#toggleAuth:hover {
    color: var(--primary);
    opacity: 1;
    transform: translateY(-2px);
}

.task-textarea:focus {
    border-color: var(--primary);
    background: #fff;
}

.image-preview-container {
    display: none;
    margin-bottom: 10px;
    padding: 10px;
    background: #fff;
    border-radius: 12px;
    position: relative;
    border: 1.5px dashed var(--primary);
    animation: fadeInScale 0.3s var(--ease-smooth);
}

.image-preview-thumb {
    max-height: 100px;
    border-radius: 8px;
    display: block;
}

.btn-remove-preview {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.duplicate-warning {
    position: absolute;
    bottom: -20px;
    left: 15px;
    font-size: 0.75rem;
    color: #ef4444;
    font-weight: 600;
    display: none;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.image-tip {
    font-size: 0.8rem;
    color: #94a3b8;
}

.btn-task-add {
    background: linear-gradient(135deg, var(--primary), #fbbf24);
    color: #0f172a;
    border: none;
    padding: 10px 25px;
    border-radius: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 5px 15px rgba(247, 183, 49, 0.3);
    gap: 8px;
}

.btn-task-add:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 10px 25px rgba(247, 183, 49, 0.5);
}

.btn-task-add::after {
    content: "Add Point";
}

/* Animations */
.stagger-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s var(--ease-out-expo) forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

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

/* Responsive */
@media (max-width: 640px) {
    .header {
        flex-direction: column;
        gap: 15px;
        padding: 20px;
    }

    .auth-card {
        padding: 32px 24px;
    }

    .notes-grid {
        grid-template-columns: 1fr;
    }
}