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

html {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    margin: 0;
    height: 100%;
    overflow: hidden;
}

.mobile-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: #fff;
    max-width: 100%;
    margin: 0 auto;
}

.app-header {
    background-color: #4CAF50;
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.home-button {
    position: absolute;
    left: 20px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.home-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.home-button:active {
    background-color: rgba(255, 255, 255, 0.2);
}

.list-title {
    font-size: 24px;
    font-weight: 500;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    margin: 0;
}

#listView .list-title {
    cursor: pointer;
}

#listView .list-title:hover {
    opacity: 0.8;
}

.list-title-input {
    font-size: 24px;
    font-weight: 500;
    background: transparent;
    border: none;
    border-bottom: 2px solid white;
    color: white;
    text-align: center;
    outline: none;
    width: 100%;
    padding: 4px;
    font-family: inherit;
}

.add-item-section {
    padding: 16px;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.input-group {
    display: flex;
    gap: 8px;
}

#itemInput {
    flex: 1;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s;
}

#itemInput:focus {
    border-color: #4CAF50;
}

.add-btn {
    width: 48px;
    height: 48px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 24px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.add-btn:active {
    background-color: #45a049;
    transform: scale(0.95);
}

.voice-btn.listening {
    background-color: #f44336;
    animation: pulse 1.5s infinite;
}

.voice-help-button {
    position: absolute;
    right: 20px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.voice-help-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.voice-help-button:active {
    background-color: rgba(255, 255, 255, 0.2);
}


@keyframes pulse {
    0% {
        box-shadow: 0 4px 12px rgba(0,0,0,0.3), 0 0 0 0 rgba(244, 67, 54, 0.7);
    }
    70% {
        box-shadow: 0 4px 12px rgba(0,0,0,0.3), 0 0 0 15px rgba(244, 67, 54, 0);
    }
    100% {
        box-shadow: 0 4px 12px rgba(0,0,0,0.3), 0 0 0 0 rgba(244, 67, 54, 0);
    }
}

.voice-status-floating {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 16px 24px;
    background-color: rgba(33, 150, 243, 0.95);
    color: white;
    border-radius: 24px;
    font-size: 16px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 2000;
    backdrop-filter: blur(10px);
    max-width: 280px;
    word-wrap: break-word;
}

.list-container {
    flex-grow: 1;
    overflow-y: auto;
    background-color: #fafafa;
}

.shopping-list {
    list-style: none;
    padding: 0;
}

.shopping-list li {
    display: flex;
    align-items: center;
    padding: 16px;
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
}

.shopping-list li:active {
    background-color: #f5f5f5;
}

.shopping-list li.completed {
    opacity: 0.6;
}

.shopping-list li.completed .item-text {
    text-decoration: line-through;
    color: #999;
}

.item-checkbox {
    width: 24px;
    height: 24px;
    margin-right: 16px;
    cursor: pointer;
}

.item-text {
    flex: 1;
    font-size: 16px;
    color: #333;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.delete-btn {
    padding: 8px 12px;
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.delete-btn:active {
    background-color: #d32f2f;
    transform: scale(0.95);
}

.bottom-actions {
    padding: 16px;
    background-color: #fff;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
    display: flex;
    gap: 12px;
    position: relative;
    justify-content: space-between;
    align-items: center;
}

.action-btn {
    padding: 12px;
    font-size: 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    background-color: #e0e0e0;
    color: #333;
}

.action-btn.icon-btn {
    width: 48px;
    height: 48px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn.voice-btn {
    width: 56px;
    height: 56px;
    background-color: #2196F3;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.action-btn:active {
    transform: scale(0.95);
}

.action-btn.danger {
    background-color: #f44336;
    color: white;
}

.action-btn.danger:active {
    background-color: #d32f2f;
}

.welcome-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.welcome-content {
    text-align: center;
    width: 100%;
    max-width: 320px;
}

.welcome-content h2 {
    font-size: 24px;
    margin-bottom: 12px;
    color: #333;
}

.welcome-content p {
    font-size: 16px;
    color: #666;
    margin-bottom: 32px;
}

.create-btn {
    width: 100%;
    padding: 16px;
    font-size: 18px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 24px;
}

.create-btn:active {
    background-color: #45a049;
    transform: scale(0.98);
}

.or-divider {
    margin: 24px 0;
    color: #999;
    font-size: 14px;
}

.list-id-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 12px;
    outline: none;
}

.list-id-input:focus {
    border-color: #4CAF50;
}

.load-btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.load-btn:active {
    background-color: #1976D2;
    transform: scale(0.98);
}


.more-menu-dropdown {
    position: absolute;
    bottom: 80px;
    right: 16px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 220px;
    padding: 8px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    margin: 0 8px;
    width: calc(100% - 16px);
    background: none;
    border: none;
    font-size: 16px;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: 8px;
}

.menu-item:hover {
    background-color: #f5f5f5;
}


.menu-item.danger {
    color: #f44336;
}

.menu-item.danger:hover {
    background-color: #ffebee;
}

.item-edit-input {
    flex: 1;
    padding: 4px 8px;
    font-size: 16px;
    border: 2px solid #4CAF50;
    border-radius: 4px;
    outline: none;
    background-color: #fff;
    color: #333;
    font-family: inherit;
}

.drag-handle {
    font-size: 20px;
    color: #999;
    margin-right: 12px;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}

/* Sortable.js styles */
.shopping-list li.blue-background {
    background-color: #e3f2fd;
    opacity: 0.8;
}

.sortable-chosen {
    opacity: 0.8;
}

.sortable-drag {
    opacity: 0.9 !important;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    background-color: #fff;
    transform: rotate(2deg);
}

@keyframes swipeOut {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(100%);
        opacity: 0;
    }
}

.shopping-list li.swipe-out {
    animation: swipeOut 0.3s ease-out forwards;
}

.shopping-list li.height-expand {
    transition: height 0.3s ease-out;
}

#listView {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

#savedLists {
    width: 100%;
    margin-bottom: 24px;
}

#savedLists h3 {
    font-size: 18px;
    margin-bottom: 12px;
    color: #333;
}

.saved-lists {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.saved-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: #f5f5f5;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s;
}

.saved-list-item:hover {
    background-color: #e8e8e8;
    transform: translateX(4px);
}

.saved-list-item .list-name {
    font-size: 16px;
    font-weight: 500;
}

.saved-list-item .list-date {
    font-size: 12px;
    color: #666;
}

.voice-help-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 20px;
}

.dialog-content {
    background-color: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.dialog-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.dialog-close:hover {
    background-color: #f5f5f5;
}

.dialog-content h2 {
    margin: 0 0 16px 0;
    color: #333;
    font-size: 24px;
}

.dialog-intro {
    color: #666;
    margin-bottom: 24px;
    font-size: 16px;
}

.command-section {
    margin-bottom: 24px;
}

.command-section h3 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 18px;
}

.command-section p {
    margin: 0 0 8px 0;
    color: #666;
}

.command-section ul {
    margin: 0;
    padding-left: 20px;
}

.command-section li {
    margin-bottom: 8px;
    color: #666;
}

.command-section strong {
    color: #2196F3;
    font-family: monospace;
    font-size: 14px;
    background-color: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
}

.dialog-note {
    margin: 24px 0 0 0;
    padding: 12px;
    background-color: #E3F2FD;
    border-radius: 8px;
    color: #1976D2;
    font-size: 14px;
    text-align: center;
}

@media (min-width: 768px) {
    .mobile-container {
        max-width: 480px;
        margin: 0 auto;
        box-shadow: 0 0 20px rgba(0,0,0,0.1);
    }
}
