:root {
    --grid-size: 80px;
    --category-size: 29px;
    --block-gap: 4px;

    /* Light mode (default) */
    --bg-color: #e6e6e6;
    --text-color: #333;
    --card-bg: #fff;
    --border-color: #ccc;
    --block-bg-color: #e0e0e0;
    --day-bg-color: #ebebeb;
    --day-bg-color-hover: #e0e0e0;
    --toggle-bg-color: #e0e0e0;
    --toggle-color: #5c5c5c;
    --toggle-btn1-color: #c4c3c3;
    --toggle-btn2-color: #c4c3c3;
    --toggle-btn3-color: #c4c3c3;
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --card-bg: #2d2d2d;
    --border-color: #444;
    --block-bg-color: #242424;
    --toggle-bg-color: #242424;
    --day-bg-color: #242424;
    --day-bg-color-hover: #444;
    --toggle-color: #5c5c5c;
    --toggle-btn1-color: #5c5c5c;
    --toggle-btn2-color: #5c5c5c;
    --toggle-btn3-color: #5c5c5c;
    }
           
        
body {
    font-family: 'Roboto', 'Source Sans Pro', Arial, sans-serif;
    padding: 20px;
    background-color: var(--bg-color);
    display: flex;
    justify-content: center;
    min-height: 100vh;  
    }

h3.section {
    font-size: 12px;
    font-family: 'Roboto', 'Source Sans Pro', Arial, sans-serif;
    font-style: italic;
    margin: 0 15px 0 0;
    color: var(--text-color);
    float: right;
}

a {
    text-decoration: none;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: flex-start !important;
    height: auto;
    min-height: 200px;
    width: 100%; 
    margin: 0 auto !important;
    margin-left: 20px !important;
}
.sub-block {
    background-color: var(--block-bg-color);
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
}

.sub-block.clicked {
    background-color: #f44336;
}

.sub-block:hover {
    opacity: 0.8;
}

.days-section {
    display: flex;
    justify-content: space-between;
    gap: var(--block-gap);
    margin-top: 10px;
    width: calc(4 * var(--grid-size) + 3 * var(--block-gap));
    touch-action: pan-x;
}

.day-square {
    width: calc((100% - 30px) / 7);
    height: 40px;
    background-color: var(--day-bg-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-transform: uppercase;
}

.day-square:hover {
    background-color: var(--day-bg-color-hover);
}

.day-square.selected {
    background-color: #811ad1;
    color: white;
}

.grid:not(.weekly-view) .highlight-block {
    position: relative;
    z-index: 100;
    overflow: visible;
    animation: pulse-glow 2s ease-in-out;
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(129, 26, 209, 0);
        outline: 3px solid rgba(129, 26, 209, 0);
    }
    50% {
        box-shadow: 0 0 30px 10px rgba(129, 26, 209, 0.8),
                    inset 0 0 30px 10px rgba(129, 26, 209, 0.5);
        outline: 3px solid rgba(129, 26, 209, 1);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(129, 26, 209, 0);
        outline: 3px solid rgba(129, 26, 209, 0);
    }
}

.controls-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.view-toggle {
    display: flex;
    gap: 5px;
}

.view-button {
    padding: 8px 16px;
    background-color: var(--toggle-bg-color);
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #666;
    text-transform: uppercase;
}

.view-button:hover {
    background-color: #d0d0d0;
}

.view-button.active {
    background-color: #811ad1;
    color: white;
}

.clear-day-button {
    width: 30px;
    height: 30px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s ease;
    font-size: 20px;
    color: #757575;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-day-button:hover {
    transform: scale(1.1);
    color: #9e9e9e;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    padding: 30px;
    /*box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);*/
    max-width: 400px;
    width: 90%;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.modal-icon {
    font-size: 32px;
    color: #ff9800;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.modal-message {
    font-size: 16px;
    color: #666;
    margin-bottom: 25px;
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-button {
    padding: 10px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-button-cancel {
    background-color: #e0e0e0;
    color: #666;
}

.modal-button-cancel:hover {
    background-color: #d0d0d0;
}

.modal-button-confirm {
    background-color: #f44336;
    color: white;
}

.modal-button-confirm:hover {
    background-color: #d32f2f;
}

#hoverTooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10000;
    white-space: nowrap;
}
.category-edit-popup {
    display: none;
    position: absolute;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 10px;
    /*box-shadow: 0 4px 8px rgba(0,0,0,0.2);*/
    z-index: 1000;
    top: 0;
    left: 0;
}

.category-edit-popup.active {
    display: flex;
    gap: 10px;
    align-items: center;
}

.category-settings-popup {
    display: none;
    position: fixed;  /* Change from absolute to fixed */
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 15px;
    /* box-shadow: 0 4px 8px rgba(0,0,0,0.2); */
    z-index: 1000;
    width: 220px;
    /* top and left will be set by JavaScript */
}

.category-settings-popup.active {
    display: block;
}

#logo {

width: 100px;
max-width: 100px;
display: block;
}

#settings {
display: block;
}

.btn-logout{
cursor: pointer;
width: 20px;
border: none;
background: none;
color: #666;
}

.stats-container {
    margin: 0 auto;
    padding: 30px;
    background: var(--card-bg);
    border-radius: 8px;
    /* box-shadow: 0 2px 4px rgba(0,0,0,0.1); */
    max-width: 900px; /* Default for mobile */
}

.stats-header {
    text-align: center;
    margin-bottom: 50px;
}

.stats-header h2 {
    color: var(--text-color);
    font-size: 20px;
    margin-bottom: 10px;
    font-weight: 600;
}

.stats-period {
    color: #666;
    font-size: 14px;
}

.category-stat {
    margin-bottom: 5px;
}

.category-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    padding: 0 5px;
}

.category-stat-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-color);
}

.category-stat-percentage {
    font-weight: 700;
    font-size: 16px;
    color: #666;
}

.category-stat-bar-container {
    width: 100%;
    height: 30px;
    background-color: #3e4353;
    
    overflow: hidden;
    position: relative;
}

.category-stat-bar {
    height: 100%;
    
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
    position: absolute; /* Change to absolute */
    left: 0;
    top: 0;
}

.category-stat-hours {
    color: #e0e0e0; /* Dark color since it'll be on gray background */
    font-size: 13px;
    font-weight: 700;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.current-date-display {
    color: var(--text-color);
}

.stats-empty {
    text-align: center;
    color: #999;
    padding: 60px 20px;
    font-size: 18px;
}


.toggle-label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.toggle-label.active {
    color: var(--text-color);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--toggle-btn1-color);
    border-radius: 30px;
    transition: all 0.4s ease;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.4s ease;
    /* box-shadow: 0 2px 4px rgba(0,0,0,0.2); */
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--toggle-btn3-color);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(30px);
}

.toggle-switch:hover .toggle-slider {
    /* box-shadow: 0 0 8px rgba(33, 150, 243, 0.4); */
}

.three-way-toggle {
    display: flex;
    gap: 0;
    background: #ff0000;
    border-radius: 20px;
    padding: 4px;
    position: relative;
    margin-bottom: 20px;
}

.three-way-toggle .toggle-label {
    flex: 1;
    padding: 8px 16px;
    text-align: center;
    cursor: pointer;
    border-radius: 16px;
    transition: all 0.3s ease;
    font-size: 14px;
    color: #888;
    position: relative;
    z-index: 2;
}

.three-way-toggle .toggle-label.active {
    color: #fff;
    font-weight: 600;
}

.three-way-toggle .toggle-label:hover {
    color: #aaa;
}


/* NEW BUTTON */
* {
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

*:focus {
    outline: none;
}

.stats-filter-toggle {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
}

.button-cover {
    height: 60px;
    background-color: transparent;
    box-shadow: none;
    border-radius: 4px;
    position: relative;
    width: 240px;
    margin: 0 auto;
}

.knobs, .layer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.button {
    position: relative;
    width: 240px;
    height: 40px;
    overflow: hidden;
}

.button.b2 {
    border-radius: 2px;
}

.checkbox {
    position: absolute;
    width: 33.33%;
    height: 100%;
    padding: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 3;
}

.stats-hours-display{
    color: var(--text-color); 
}

.checkbox-1 {
    left: 0;
}

.checkbox-2 {
    left: 33.33%;
}

.checkbox-3 {
    left: 66.66%;
}

.knobs {
    z-index: 2;
}

.layer {
    width: 100%;
    background-color: var(--card-bg); 
    transition: 0.3s ease all;
    z-index: 1;
    border-radius: 2px;
}
#button-13 .knobs:before,
#button-13 .knobs:after,
#button-13 .layer:after {
    color: var(--text-color);  /* Add this to make text change with theme */
}

/* Labels - fixed positioning */
#button-13 .knobs:before {
    content: 'Productive';
    position: absolute;
    top: 4px;
    left: 10px;
    width: 70px;
    height: 32px;
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    line-height: 32px;
    padding: 0;
    transition: 0.3s ease all;
    color: var(--text-color);
    z-index: 1;
}

#button-13 .knobs:after {
    content: 'All';
    position: absolute;
    top: 4px;
    left: 85px;
    width: 70px;
    height: 32px;
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    line-height: 32px;
    padding: 0;
    transition: 0.3s ease all;
    color: var(--text-color);
    z-index: 1;
}

#button-13 .layer:after {
    content: 'Non-Prod';
    position: absolute;
    top: 4px;
    right: 10px;
    width: 70px;
    height: 32px;
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    line-height: 32px;
    padding: 0;
    transition: 0.3s ease all;
    color: #888;
    z-index: 1;
}

/* Sliding button */
#button-13 .knobs span {
    position: absolute;
    top: 4px;
    width: 70px;
    height: 32px;
    background-color: var(--toggle-btn1-color);
    border-radius: 2px;
    transition: 0.3s cubic-bezier(0.18, 0.89, 0.35, 1.15) all;
    left: 4px;
    z-index: 2;
}

/* State 1: Productive (default) */
#button-13 .checkbox-1:checked ~ .knobs span {
    left: 4px;
    background-color: var(--toggle-btn1-color);
}

#button-13 .checkbox-1:checked ~ .knobs:before {
    color: #fff;
}

/* State 2: All */
#button-13 .checkbox-2:checked ~ .knobs span {
    left: 85px;
    color: var(--text-color);
    background-color: var(--toggle-btn2-color);
}

#button-13 .checkbox-2:checked ~ .knobs:after {
    color: #fff;
}

/* State 3: Non-Productive */
#button-13 .checkbox-3:checked ~ .knobs span {
    left: 166px; 
    background-color: var(--toggle-btn3-color);
}

#button-13 .checkbox-3:checked ~ .layer:after {
    color: #fff;
}


.categories-section {
    background-color: var(--card-bg);
    position: relative;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    max-width: 355px;
    box-sizing: border-box;
    position: relative;
    display: block; /* Force block display */
    clear: both; 
    float: left !important;
    max-width: 355px !important;
    overflow: visible; 
    /* margin-right: 20px !important; */
}

@media (min-width: 768px){
    .categories-section{
        background-color: transparent;
    }
}
.categories-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    max-width: 355px;
    overflow: visible;
}


.category-square {
    width: fit-content;
    height: var(--category-size);
    border-radius: 2px;
    cursor: pointer;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
    display: flex;
    align-items: center;
    white-space: nowrap;
    flex-shrink: 0;
    padding-right: 8px;
}

.category-indicator {
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
}

.category-indicator svg {
    display: block;
    width: 12px;
    height: 12px;
}

@media (min-width: 769px) {
    .category-indicator-track {
        position: absolute;
        left: 250px;  /* Width of categories section */
        top: 0;
        width: 30px;
        height: 100%;
        pointer-events: none;
    }
    
    .category-indicator-arrow {
        position: absolute;
        font-size: 20px;
        transition: top 0.3s ease;
    }
}

.category-square.add-button {
    background-color: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: #666;
    flex-shrink: 0;
    overflow: hidden;
    width: var(--category-size);  /* Keep add button as square */
    padding-right: 0px;
}

    
@media (min-width: 769px) {
    .category-content {
        display: flex;
        align-items: center;
        gap: 8px;
        padding-left: 8px;
        white-space: nowrap;
        opacity: 1;
        transition: opacity 0.3s ease 0.2s;
        pointer-events: auto;
    }
}

/* This controls the square's expansion */
.category-square.expanded {
    width: fit-content;
    padding-right: 8px;
    overflow: visible;
}

/* This controls the content visibility */
.category-square.expanded .category-content {
    opacity: 1;
    pointer-events: auto;
}

.category-name {
    font-size: 14px;
    color: white;
    font-weight: 500;
    /* text-shadow: 0 1px 2px rgba(0,0,0,0.3); */
    outline: none;
    border: none;
    background: transparent;
    padding: 0;
    font-family: inherit;
    width: auto;
}


.category-name:disabled {
    color: white;
}

.main-categories-section {
    width: 100%;
    max-width: 355px;
    margin-bottom: 20px;
}



.icon-button {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 6px;
    border-radius: 3px;
    transition: background-color 0.2s;
    flex-shrink: 0;
    color: white;
}

.icon-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.color-picker-popup {
    display: none;
    position: absolute;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 10px;
    /*box-shadow: 0 4px 8px rgba(0,0,0,0.2);*/
    z-index: 1000;
    top: 0;
    left: 0;
}

.color-picker-popup.active {
    display: flex;
    gap: 10px;
    align-items: center;
}

.color-picker-popup input[type="color"] {
    width: 150px;
    height: 40px;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
}


.color-apply-button {
    width: 30px;
    height: 30px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s ease;
    font-size: 30px;
    color: #56c700;
    display: flex;
    align-items: center;
    justify-content: center;
}



.color-apply-button svg {
    width: 10px;
    height: 10px;
    fill: white;
}

.grid-container {
    background-color: var(--card-bg);
    padding: 10px;
    border-radius: 8px;
    width: 332px;
    max-width: 332px;
    position: relative;
    height: auto;
    overflow: visible;
}



.week-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    /* padding: 10px 0; */
}

.week-nav-button {
    background-color: #811ad1;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
}

.week-nav-button:hover {
    background-color: #a75ddf;
    transform: scale(1.1);
}

.week-nav-button:disabled {
    background-color: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    transform: scale(1);
}

.week-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    min-width: 150px;
    text-align: center;
    text-transform: uppercase;
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, var(--grid-size));
    /* grid-template-rows: repeat(6, var(--grid-size)); */
    grid-template-rows: repeat(var(--grid-size));
    gap: var(--block-gap);
    transition: all 0.3s ease;
    overflow: visible;
    /* touch-action: none; */
}

/* Weekly grid */
    /* .weekly-grid-container {
        float: left !important;
        width: 320px !important;
        max-width: 320px !important;
        margin-right: 20px !important;
        display: block !important;
    } */

/* .grid.weekly-view {
    grid-template-columns: repeat(13, 20px);
    grid-template-rows: repeat(20px);
} */

/* .grid.weekly-view .block {
    width: 20px;
    height: 20px;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
} */

/* .grid.weekly-view .block-number {
    font-size: 8px;
} */

@media (min-width: 769px) {

    .weekly-grid-container {
        width: 335px;
        max-width: 335px;
        float: left;
        /* margin-left: 20px;  */
        margin-right: 10px;
    }
    .weekly-grid-wrapper {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
        padding: 4px;
        width: 100%;
    }
    
    .weekly-day-grid {
    border-radius: 8px;
    padding: 6px;
    background: var(--card-bg);
    width: fit-content; /* ADD THIS */
    }

/* DELETE all these if they exist: */
/* .weekly-day-grid:nth-child(5) { ... } */
/* .weekly-day-grid:nth-child(n+5) { ... } */
       
       
    .weekly-mini-block {
    width: 15px !important;
    height: 15px !important;
    border-radius: 2px;
    cursor: pointer;
    transition: transform 0.1s;
    position: relative;
    }

    .weekly-mini-grid {
    display: grid;
    grid-template-columns: repeat(4, 15px);
    grid-template-rows: repeat(6, 15px);
    gap: 2px;
    }
    
    .weekly-mini-block:hover {
        transform: scale(1.05);
        z-index: 10;
    }
}


.block {
    width: var(--grid-size);
    height: var(--grid-size);
    background-color: transparent;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 0;
    padding: 0;
    border-radius: 2px;
    overflow: visible; 
    position: relative;
}

.block-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.2);
    /* font-size: calc(var(--grid-size) * 0.6); */
    font-size: 24px;
    font-weight: bold;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

.block:hover .block-number {
    opacity: 1;
}

@media (min-width: 769px) {
    .container {
        width: 100% !important;
        display: block !important;
    }
    
    .main-content-wrapper {
    display: block;
    width: 100%;
}
    .main-content-wrapper {
        display: block !important;
        width: fit-content !important;
        float: left !important;
        clear: both !important;
    }
    
    
    
    .grid-container {
        float: left !important;
        width: 332px !important;
        max-width: 332px !important;
        margin-right: 10px !important;
    }
    
    .stats-container {
        float: left !important;
        width: 355px !important;
        max-width: 700px !important;
        margin: 0 !important;
        display: block;
    }
    
    .categories-grid {
        display: flex !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        align-items: end;
    }
    
    /* Clear floats */
    .main-content-wrapper::after {
        content: "";
        display: table;
        clear: both;
    }

        
}

@media (min-width: 769px) {
    .container {
        width: 100% !important;
        display: block !important;
    }
    
    .main-content-wrapper {
        display: block !important;
        width: fit-content !important;
        float: left !important;
        clear: both !important;
    }
    
    .categories-section {
        float: left !important;
        width: 355px !important;
        max-width: 355px !important;
        /* margin-right: 20px !important; */
    }
        
    .categories-grid {
        display: flex !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
    }
    
    /* Hide view toggle on desktop */
    .view-toggle {
        display: none !important;
    }
    
    /* Clear floats */
    .main-content-wrapper::after {
        content: "";
        display: table;
        clear: both;
    }
}