/* GrocerySync Styles
   This CSS file contains styles for the GrocerySync web application.
   It includes responsive design and button styles for both desktop and mobile devices.
*/

/* Reset and base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Base body styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Main content wrapper styles */
#main-content {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: 80px;
    position: relative;
    flex-grow: 1;
}

/* Header styles */
h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 20px;
    position: relative;
}

h1 .version {
    font-size: 0.7em;
    top: 0;
}

/* List container styles */
.list-container {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

/* List header styles */
.list-header {
    background-color: #ecf0f1;
    color: #34495e;
    padding: 10px 15px;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* List styles */
ul {
    list-style-type: none;
}

li {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.2s ease, background-color 0.2s ease;
    background-color: #fff;
}

li:last-child {
    border-bottom: none;
}

/* Checkbox styles */
input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin-right: 11px;
    vertical-align: middle;
}

/* Completed items styles */
#completed-items li {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.completed-item-content {
    display: flex;
    flex-grow: 1;
    justify-content: space-between;
    align-items: center;
    margin-right: 10px;
}

.completed-item-name {
    margin-right: 10px;
}

.completed-info {
    font-size: 0.8em;
    text-align: right;
    white-space: nowrap;
}

/* Button styles */
.btn {
    padding: 5px 10px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    margin-left: 5px;
}

.reorder-btn {
    background-color: #95a5a6;
    color: white;
}

.rename-btn {
    background-color: #95a5a6;
    color: white;
    margin-right: 10px;
}

.restore-btn {
    background-color: #59CD90;
    color: white;
}

.delete-btn {
    background-color: #EE6352;
    color: white;
}

.toggle-btn {
    background-color: #95a5a6;
    color: white;
}

/* Input container styles */
.input-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #fff;
    padding: 10px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    z-index: 1000;
}

#reorder-btn {
    display: none;
}

#new-item {
    flex-grow: 1;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
}

#add-item {
    padding: 10px 15px;
    background-color: #3FA7D6;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 16px;
}

/* Ensure content doesn't go under the input box */
#content-wrapper {
    padding-bottom: 60px;
}

/* Updated drag handle styles */
.drag-handle {
    cursor: move;
    padding: 10px;
    margin: -10px;
    font-size: 24px;
    color: #95a5a6;
    touch-action: none;
    user-select: none;
}

/* Updated list item styles for dragging */
#grocery-list li.dragging {
    opacity: 0.9;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transform: scale(1.02);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

/* Shadow line styles */
.shadow-line {
    height: 2px;
    background-color: #3FA7D6;
    position: absolute;
    transition: transform 0.1s ease, width 0.1s ease, left 0.1s ease;
}

/* Settings styles */
#settings-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    z-index: 1001;
}

#settings-menu {
    position: absolute;
    top: 50px;
    right: 20px;
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 10px;
    z-index: 1000;
    display: none;
    min-width: 200px;
}

#settings-menu.show {
    display: block;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#settings-menu label {
    margin-right: 10px;
}

/* Updated styles for the theme dropdown */
#theme-select {
    flex-grow: 1;
    padding: 5px;
    border-radius: 3px;
    border: 1px solid #ddd;
    font-size: 16px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7em top 50%;
    background-size: 0.65em auto;
    padding-right: 1.5em;
}

/* Hover styles for mouse devices */
@media (hover: hover) {
    .reorder-btn:hover {
        background-color: #7f8c8d;
    }

    .rename-btn:hover {
        background-color: #7f8c8d;
    }

    .restore-btn:hover {
        background-color: #3ac079;
    }

    .delete-btn:hover {
        background-color: #ea3c26;
    }

    .toggle-btn:hover {
        background-color: #7f8c8d;
    }

    #add-item:hover {
        background-color: #2993c2;
    }

    .drag-handle:hover {
        color: #7f8c8d;
    }

    #settings-icon:hover {
        opacity: 0.8;
    }
}

/* Active styles for all devices */
.reorder-btn:active,
.rename-btn:active,
.toggle-btn:active {
    background-color: #7f8c8d;
}

.restore-btn:active {
    background-color: #3ac079;
}

.delete-btn:active {
    background-color: #ea3c26;
}

#add-item:active {
    background-color: #2993c2;
}

.drag-handle:active {
    color: #7f8c8d;
}

#settings-icon:active {
    opacity: 0.8;
}

/* Responsive design */
@media (max-width: 480px) {
    #main-content {
        padding: 10px;
        padding-bottom: 70px;
    }

    .completed-item-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .completed-info {
        margin-top: 5px;
    }

    #settings-icon {
        top: 10px;
        right: 10px;
    }

    #settings-menu {
        top: 40px;
        right: 10px;
        min-width: 200px;
    }

    input[type="checkbox"] {
        width: 26px;
        height: 26px;
        margin-right: 13px;
    }

    #theme-select {
        font-size: 18px;
        padding: 8px 24px 8px 8px;
    }
}

/* Theme styles */
body.light-theme {
    background-color: #f4f4f4;
    color: #333;
}

body.dark-theme {
    background-color: #2c3e50;
    color: #ecf0f1;
}

body.dark-theme h1,
body.dark-theme li,
body.dark-theme #completed-items li {
    color: #ecf0f1;
}

body.dark-theme .list-container,
body.dark-theme #settings-menu {
    background-color: #34495e;
}

body.dark-theme .list-header {
    background-color: #2c3e50;
    color: #ecf0f1;
}

body.dark-theme li {
    background-color: #34495e;
    border-bottom-color: #2c3e50;
}

body.dark-theme #new-item,
body.dark-theme #theme-select {
    background-color: #34495e;
    color: #ecf0f1;
    border-color: #4a6b8a;
}

body.dark-theme .input-container {
    background-color: #2c3e50;
}

body.dark-theme #add-item {
    background-color: #3498db;
}

body.dark-theme .btn {
    background-color: #3498db;
}

body.dark-theme .delete-btn {
    background-color: #e74c3c;
}

body.dark-theme .restore-btn {
    background-color: #2ecc71;
}

/* Blue Theme */
body.blue-theme {
    background-color: #9BF6FF;
    color: #00647A;
}

body.blue-theme li,
body.blue-theme #completed-items li {
    color: #00647A;
}

body.blue-theme .list-container,
body.blue-theme #settings-menu {
    background-color: #B4F8FF;
}

body.blue-theme .list-header {
    background-color: #6AEEFF;
    color: #00647A;
}

body.blue-theme li {
    background-color: #B4F8FF;
    border-bottom-color: #6AEEFF;
}

body.blue-theme #new-item,
body.blue-theme #theme-select {
    background-color: #D6FCFF;
    color: #00647A;
    border-color: #6AEEFF;
}

body.blue-theme .input-container {
    background-color: #B4F8FF;
}

body.blue-theme #add-item,
body.blue-theme .btn {
    background-color: #00A3C4;
    color: #FFFFFF;
}

/* Green Theme */
body.green-theme {
    background-color: #CAFFBF;
    color: #1F6600;
}

body.green-theme li,
body.green-theme #completed-items li {
    color: #1F6600;
}

body.green-theme .list-container,
body.green-theme #settings-menu {
    background-color: #DAFFCF;
}

body.green-theme .list-header {
    background-color: #9EFF80;
    color: #1F6600;
}

body.green-theme li {
    background-color: #DAFFCF;
    border-bottom-color: #9EFF80;
}

body.green-theme #new-item,
body.green-theme #theme-select {
    background-color: #EAFFDF;
    color: #1F6600;
    border-color: #9EFF80;
}

body.green-theme .input-container {
    background-color: #DAFFCF;
}

body.green-theme #add-item,
body.green-theme .btn {
    background-color: #4CAF50;
    color: #FFFFFF;
}

/* Pink Theme */
body.pink-theme {
    background-color: #FFC6FF;
    color: #800080;
}

body.pink-theme li,
body.pink-theme #completed-items li {
    color: #800080;
}

body.pink-theme .list-container,
body.pink-theme #settings-menu {
    background-color: #FFD6FF;
}

body.pink-theme .list-header {
    background-color: #FF9EFF;
    color: #800080;
}

body.pink-theme li {
    background-color: #FFD6FF;
    border-bottom-color: #FF9EFF;
}

body.pink-theme #new-item,
body.pink-theme #theme-select {
    background-color: #FFE6FF;
    color: #800080;
    border-color: #FF9EFF;
}

body.pink-theme .input-container {
    background-color: #FFD6FF;
}

body.pink-theme #add-item,
body.pink-theme .btn {
    background-color: #FF69B4;
    color: #FFFFFF;
}

/* Purple Theme */
body.purple-theme {
    background-color: #BDB2FF;
    color: #3D2F7D;
}

body.purple-theme li,
body.purple-theme #completed-items li {
    color: #3D2F7D;
}

body.purple-theme .list-container,
body.purple-theme #settings-menu {
    background-color: #CAC2FF;
}

body.purple-theme .list-header {
    background-color: #9D8EFF;
    color: #3D2F7D;
}

body.purple-theme li {
    background-color: #CAC2FF;
    border-bottom-color: #9D8EFF;
}

body.purple-theme #new-item,
body.purple-theme #theme-select {
    background-color: #D7D1FF;
    color: #3D2F7D;
    border-color: #9D8EFF;
}

body.purple-theme .input-container {
    background-color: #CAC2FF;
}

body.purple-theme #add-item,
body.purple-theme .btn {
    background-color: #7B68EE;
    color: #FFFFFF;
}

/* Yellow Theme */
body.yellow-theme {
    background-color: #FDFFB6;
    color: #806600;
}

body.yellow-theme li,
body.yellow-theme #completed-items li {
    color: #806600;
}

body.yellow-theme .list-container,
body.yellow-theme #settings-menu {
    background-color: #FEFFC6;
}

body.yellow-theme .list-header {
    background-color: #FCFF8F;
    color: #806600;
}

body.yellow-theme li {
    background-color: #FEFFC6;
    border-bottom-color: #FCFF8F;
}

body.yellow-theme #new-item,
body.yellow-theme #theme-select {
    background-color: #FFFFD6;
    color: #806600;
    border-color: #FCFF8F;
}

body.yellow-theme .input-container {
    background-color: #FEFFC6;
}

body.yellow-theme #add-item,
body.yellow-theme .btn {
    background-color: #FFC107;
    color: #FFFFFF;
}

/* Hover styles for themed buttons */
@media (hover: hover) {

    body.blue-theme #add-item:hover,
    body.blue-theme .btn:hover {
        background-color: #0081A1;
    }

    body.green-theme #add-item:hover,
    body.green-theme .btn:hover {
        background-color: #3D8B40;
    }

    body.pink-theme #add-item:hover,
    body.pink-theme .btn:hover {
        background-color: #FF1493;
    }

    body.purple-theme #add-item:hover,
    body.purple-theme .btn:hover {
        background-color: #6A5ACD;
    }

    body.yellow-theme #add-item:hover,
    body.yellow-theme .btn:hover {
        background-color: #FFA000;
    }
}

/* Active styles for themed buttons */
body.blue-theme #add-item:active,
body.blue-theme .btn:active {
    background-color: #0081A1;
}

body.green-theme #add-item:active,
body.green-theme .btn:active {
    background-color: #3D8B40;
}

body.pink-theme #add-item:active,
body.pink-theme .btn:active {
    background-color: #FF1493;
}

body.purple-theme #add-item:active,
body.purple-theme .btn:active {
    background-color: #6A5ACD;
}

body.yellow-theme #add-item:active,
body.yellow-theme .btn:active {
    background-color: #FFA000;
}