/* HabitWins Dashboard CSS */

/* Dashboard Side-by-Side Layout */
.dashboard-main {
    display: flex;
    gap: 16px;
    margin-bottom: 25px;
    min-height: 100vh; /* Mobile needs this */
    align-items: flex-start;
}

/* Desktop - remove min-height to prevent extra scroll */
@media (min-width: 869px) {
    .dashboard-main {
        min-height: auto !important;
    }
}

.dashboard-left {
    flex: 1;
    min-width: 50%;
    max-height: 100vh;
    overflow-y: auto;
}

.dashboard-right {
    flex: 1;
    min-width: 50%;
}

/* Tasks Header */
.tasks-header {
    margin-bottom: 8px;
}

.tasks-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #333;
}

/* RAINBOW Theme - white text with soft shadow for readability on purple background */
[data-theme="rainbow"] .tasks-header h3 {
    color: white;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

/* NEON Theme - bright neon green title */
[data-theme="neon"] .tasks-header h3 {
    color: #00FF88;
    font-family: 'Space Grotesk', monospace;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

/* MINIMAL Theme - professional blue title */
[data-theme="minimal"] .tasks-header h3 {
    color: var(--text-secondary);  /* Dark slate text on white background */
    font-family: 'Inter', sans-serif;
    font-weight: 700;
}

/* Navigation Container */
/* WARNING: .contracts-list gap is defined in contracts.css - DO NOT set gap here */
/* contracts.css is SINGLE SOURCE OF TRUTH for .contracts-list styling */
.contracts-list {
    display: flex;
    flex-direction: column;
    /* gap: defined in contracts.css */
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Contract card styles moved to contracts.css - SINGLE SOURCE OF TRUTH */

.contract-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.contract-title {
    display: flex;
    align-items: center;
    gap: 6px;
}

.contract-icon {
    font-size: 1.1rem;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    color: white;
}

.contract-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
}

.contract-category {
    font-size: 0.75rem;
    color: #666;
}

.contract-status {
    text-align: right;
}

.days-left {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.streak {
    font-size: 0.8rem;
    color: #10B981;
    font-weight: 500;
}

.contract-progress {
    margin-bottom: 12px;
}

.progress-label {
    display: flex;
    -webkit-justify-content: space-between;
    -ms-flex-pack: justify;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: #666;
}

.progress-bar {
    height: 6px;
    background: #f0f0f0;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.contract-actions {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}

.action-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-track {
    background: #10B981;
    color: white;
}

.btn-track:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-info {
    background: #f8f9fa;
    color: #666;
    border: 2px solid #eee;
}

.btn-info:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

/* Daily Quote Section - reserve space to prevent layout jump */

/* Mobile & Desktop Add Contract Button */
.mobile-add-contract-btn {
    display: none; /* Hidden by default, shown in specific breakpoints */
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    margin: 8px auto;
    width: fit-content;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mobile-add-contract-btn .btn-icon {
    font-size: 1.3rem;
    font-weight: 700;
}

/* RAINBOW Theme */
[data-theme="rainbow"] .mobile-add-contract-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

[data-theme="rainbow"] .mobile-add-contract-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* NEON Theme */
[data-theme="neon"] .mobile-add-contract-btn {
    background: linear-gradient(135deg, #00FF88 0%, #00D9FF 100%);
    color: #0a0e27;
    font-family: 'Space Grotesk', monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
}

[data-theme="neon"] .mobile-add-contract-btn:hover {
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.6);
    transform: translateY(-2px);
}

/* MINIMAL Theme */
[data-theme="minimal"] .mobile-add-contract-btn {
    background: linear-gradient(135deg, #42a5f5 0%, #1e88e5 100%);
    color: white;
    font-family: 'Inter', sans-serif;
}

[data-theme="minimal"] .mobile-add-contract-btn:hover {
    background: linear-gradient(135deg, #1e88e5 0%, #1565c0 100%);
    transform: translateY(-2px);
}

/* Desktop - Full screen layout with fixed navbar */
@media (min-width: 869px) {
    body {
        overflow: hidden !important;
        height: 100vh !important;
    }

    .container {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
        height: 100vh !important;
        padding-top: 70px !important; /* Space for fixed navbar (60px navbar + 10px gap) */
    }

    /* Align map (dashboard-left) with first contract card */
    .dashboard-left {
        padding-top: 90px; /* Button (48px) + tasks-header (26px) + spacing (16px) = align with first card */
        max-height: calc(100vh - 70px); /* Full viewport height minus navbar */
        overflow-y: auto;
    }

    /* Match right column height with left column */
    .dashboard-right {
        max-height: calc(100vh - 70px); /* Same height as dashboard-left */
        overflow-y: auto;
    }

    /* Show add contract button on desktop - now inside dashboard-right */
    .mobile-add-contract-btn {
        display: flex !important;
        margin: 0 auto 16px auto; /* Centered, 16px bottom margin before tasks-header */
    }
}

/* Mobile Responsive */
@media (max-width: 868px) {
    .dashboard-main {
        flex-direction: column !important;
        gap: 0 !important; /* Zero gap - contracts touch map directly */
        margin: 0 !important;
        padding: 68px 5px 0 5px !important; /* Top 68px for fixed navbar + spacing, sides 5px */
        min-height: 100vh;
    }
    
    .dashboard-left, 
    .dashboard-right {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important; /* Usunięcie wewnętrznego paddingu */
        margin: 0 !important; /* Usunięcie marginesów */
        box-sizing: border-box;
    }
    
    .calendar-section,
    .tasks-section {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important; /* Zero margin - no spacing between sections */
        border-radius: 12px !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08) !important; /* Lżejszy cień */
    }
    
    /* Reset marginesów dla sekcji kalendarza */
    .calendar-section {
        margin-top: 0 !important;
        padding: 12px 10px !important; /* Mniejszy padding */
    }

    .dashboard-left {
        min-height: auto !important;
        max-height: none !important; /* Usunięcie ograniczenia wysokości */
        order: 2;
        overflow: visible !important; /* Zmiana na visible, aby uniknąć przycinania */
        margin: 0 !important; /* Spacing handled by progress-map-section margin-top */
        padding: 0 !important;
        height: auto !important;
    }
    
    .global-calendar-section {
        margin: 0 !important;
        padding: 12px 10px !important;
        max-height: none !important;
        height: auto !important;
    }

    .dashboard-right {
        order: 1;
        min-width: 100%;
        margin: 0 !important; /* Remove any margins */
        padding: 0 !important; /* Ensure no padding adding vertical space */
    }
    
    /* ✅ FIXED: Zero margin for tasks header on mobile */
    .tasks-header {
        margin-bottom: 0 !important;
        margin-top: 0 !important;
        padding: 0 !important;
    }

    /* Show add contract button on mobile - now inside dashboard-right */
    .mobile-add-contract-btn {
        display: flex !important;
        margin: 0 auto 8px auto !important; /* Centered, 8px bottom margin before tasks-header */
    }

    /* Scroll and sizing for tasks list on mobile */
    /* WARNING: gap is defined in contracts.css with !important - DO NOT override here */
    .contracts-list {
        max-height: 234px; /* Exactly 3 cards: 3×70px + 2×12px spacing = 234px */
        overflow-y: auto;
        width: 100% !important;
        padding: 0 !important;
        margin-bottom: 0 !important; /* Remove bottom spacing */
        scrollbar-width: thin; /* Firefox */
        scrollbar-color: rgba(102, 126, 234, 0.3) transparent; /* Firefox */
    }

    /* Webkit scrollbar styling */
    .contracts-list::-webkit-scrollbar {
        width: 6px;
    }

    .contracts-list::-webkit-scrollbar-track {
        background: transparent;
    }

    .contracts-list::-webkit-scrollbar-thumb {
        background: rgba(102, 126, 234, 0.3);
        border-radius: 3px;
    }

    .contracts-list::-webkit-scrollbar-thumb:hover {
        background: rgba(102, 126, 234, 0.5);
    }

    /* Contract card mobile sizing moved to contracts.css - loaded after dashboard.css */

    /* Visual scroll indicator when scrollable */
    .contracts-list::after {
        content: '';
        display: block;
        height: 1px;
        background: transparent;
    }
}

@media (max-width: 768px) {
    .quote-author {
        font-size: 0.85rem;
    }
}

/* Small mobile (480px) - Reduce container height for smaller cards */
@media (max-width: 480px) {
    .contracts-list {
        max-height: 180px !important; /* Adjusted for 3x 58px cards + spacing */
    }
}

/* ========================================= */
/*    ONBOARDING HELPER (Empty State)       */
/* ========================================= */

.onboarding-helper {
    position: relative;
    min-height: 250px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.onboarding-helper.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Position arrow - Desktop default (151.55mm / 237.63mm = 63.78%) */
/* Arrow tip should be just BELOW navbar (19.54mm ≈ 82px)
   Navbar height: ~82px, arrow tip at ~87px (5px gap)
   Dashboard-right starts after navbar, so relative position: 87 - 82 = 5px
   SVG arrow tip is at y=30 in viewBox, so: 5 - 30 = -25px
   User adjustments: +10px, then +20px, then -5px = +25px total */
.onboarding-arrow {
    position: absolute;
    right: 370px;  /* Desktop: shifted back 10px right (380 - 10) */
    top: 0px;
    transform: translateX(50%);  /* Center arrow on button */
}

/* Position text below arrow */
.onboarding-text {
    position: absolute;
    right: 370px;  /* Desktop: match arrow (380 - 10) */
    top: 130px;  /* 0px (arrow top) + 120px (arrow height) + 10px gap = 130px */
    transform: translateX(50%);  /* Center text on button */
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.4;
    max-width: 250px;
}

.arrow-img {
    width: 60px;
    height: 120px;
    display: block;
}

/* ========================================= */
/*       THEME-SPECIFIC STYLES              */
/* ========================================= */

/* RAINBOW Theme - colorful and playful */
[data-theme="rainbow"] .onboarding-text {
    color: white;
    text-shadow: 0 3px 10px rgba(118, 75, 162, 0.4);
}

[data-theme="rainbow"] .arrow-img {
    animation: arrowBounceUp 1.5s ease-in-out infinite;
}

/* NEON Theme - dark with glowing effects */
[data-theme="neon"] .onboarding-text {
    color: #00FF88;
    font-family: 'Space Grotesk', monospace;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-shadow: 0 0 15px rgba(0, 255, 136, 0.7);
}

[data-theme="neon"] .arrow-img {
    animation: arrowBounceUp 1.5s ease-in-out infinite;
}

/* MINIMAL Theme - clean and professional */
[data-theme="minimal"] .onboarding-text {
    color: var(--text-secondary);  /* Dark slate text on white background */
    font-family: 'Inter', sans-serif;
    text-shadow: none;  /* No shadow needed on white background */
}

[data-theme="minimal"] .arrow-img {
    animation: arrowBounceUpSubtle 2s ease-in-out infinite !important;
    animation-duration: 2s !important;
}

/* ========================================= */
/*            ANIMATIONS                     */
/* ========================================= */

/* Arrow pointing UP bounce animations */
@keyframes arrowBounceUp {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(15px);
    }
}

@keyframes arrowBounceUpSubtle {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(10px);
    }
}

/* ========================================= */
/*         RESPONSIVE POSITIONING            */
/* ========================================= */

/* Mobile - button in navbar stays at same distance from right edge */
@media (max-width: 768px) {
    .onboarding-helper {
        min-height: 180px;
    }

    .onboarding-arrow {
        right: 140px;  /* Shifted another 30px left (110 + 30) */
        top: 0px;
    }

    .onboarding-text {
        right: 140px;  /* Match arrow (110 + 30) */
        top: 110px;  /* 0px + 100px (arrow height) + 10px gap */
        font-size: 1.1rem;
        max-width: 220px;
    }

    .arrow-img {
        width: 50px;
        height: 100px;
    }
}

@media (max-width: 480px) {
    .onboarding-helper {
        min-height: 150px;
    }

    .onboarding-arrow {
        right: 135px;  /* Small mobile: shifted 5px more left (130 + 5) */
        top: 0px;
    }

    .onboarding-text {
        right: 135px;  /* Small mobile: match arrow (130 + 5) */
        top: 90px;  /* 0px + 80px (arrow height) + 10px gap */
        font-size: 1rem;
        max-width: 200px;
    }

    .arrow-img {
        width: 40px;
        height: 80px;
    }
}