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

:root {
    --teal-400: #2dd4bf;
    --teal-500: #14b8a6;
    --teal-600: #0d9488;
    --mint-100: #d1fae5;
    --mint-200: #a7f3d0;
    --mint-300: #6ee7b7;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --red-500: #ef4444;
    --red-100: #fee2e2;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfeff 50%, #f0f9ff 100%);
    min-height: 100vh;
}

.app-container {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--teal-500) 0%, var(--mint-300) 100%);
    padding: 1.5rem;
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(20, 184, 166, 0.3);
}

.header-content {
    text-align: center;
}

.header-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.header-icon {
    font-size: 1.75rem;
}

.header-title h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-subtitle {
    font-size: 1rem;
    opacity: 0.95;
    margin-top: 0.25rem;
}

.header-free {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: 0.25rem;
    font-style: italic;
}

/* Main content */
.main-content {
    flex: 1;
    padding: 1.5rem;
    padding-bottom: 6rem;
}

/* Recording section */
.recording-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.5rem;
}

.mic-button {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--teal-500) 0%, var(--teal-600) 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 30px rgba(20, 184, 166, 0.4);
    transition: all 0.3s ease;
}

.mic-button:hover:not(.disabled) {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(20, 184, 166, 0.5);
}

.mic-button:active:not(.disabled) {
    transform: scale(0.98);
}

.mic-button.recording {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    animation: pulse 1.5s infinite;
    box-shadow: 0 8px 30px rgba(239, 68, 68, 0.4);
}

.mic-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(239, 68, 68, 0);
    }
}

/* Waveform */
.waveform-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 50px;
    margin-top: 1rem;
}

.waveform-bar {
    width: 4px;
    background: linear-gradient(to top, var(--teal-400), var(--mint-300));
    border-radius: 2px;
    transition: height 0.1s ease;
}

.recording-status {
    margin-top: 0.75rem;
    color: var(--gray-600);
    font-size: 0.95rem;
}

.not-supported {
    margin-top: 0.5rem;
    color: var(--red-500);
    font-size: 0.85rem;
    text-align: center;
}

/* Transcript card */
.transcript-card {
    background: white;
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.transcript-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    color: var(--gray-500);
    font-size: 0.85rem;
}

.edit-btn {
    background: none;
    border: none;
    color: var(--teal-500);
    cursor: pointer;
    font-size: 0.85rem;
}

.transcript-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: var(--gray-700);
    background: var(--gray-50);
    padding: 0.75rem;
    border-radius: 8px;
    line-height: 1.5;
}

.transcript-edit {
    width: 100%;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    padding: 0.75rem;
    border: 2px solid var(--teal-400);
    border-radius: 8px;
    resize: vertical;
    min-height: 80px;
    outline: none;
}

.transcript-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.add-items-btn {
    flex: 1;
    padding: 0.75rem;
    background: linear-gradient(135deg, var(--teal-500) 0%, var(--teal-600) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-items-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(20, 184, 166, 0.3);
}

.discard-btn {
    padding: 0.75rem 1rem;
    background: var(--gray-100);
    color: var(--gray-600);
    border: none;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.discard-btn:hover {
    background: var(--gray-200);
}

/* Shopping list */
.shopping-list {
    margin-bottom: 1.5rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-500);
}

.empty-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.empty-hint {
    font-size: 0.9rem !important;
    opacity: 0.8;
}

/* Category group */
.category-group {
    background: white;
    border-radius: 16px;
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.category-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--gray-50);
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
}

.category-header:hover {
    background: var(--gray-100);
}

.category-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--gray-700);
}

.category-icon {
    font-size: 1.25rem;
}

.item-count {
    font-size: 0.85rem;
    color: var(--gray-400);
    font-weight: 400;
}

.category-items {
    padding: 0.5rem;
}

/* Shopping item */
.shopping-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    border-radius: 12px;
    transition: all 0.2s ease;
    position: relative;
}

.shopping-item:hover {
    background: var(--gray-50);
}

.shopping-item.checked {
    opacity: 0.6;
}

.item-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.checkbox {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 2px solid var(--gray-300);
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.checkbox:hover {
    border-color: var(--teal-400);
}

.checkbox.checked {
    background: var(--teal-500);
    border-color: var(--teal-500);
    color: white;
}

.item-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.item-name {
    font-weight: 500;
    color: var(--gray-700);
    transition: all 0.3s ease;
}

.quantity {
    color: var(--teal-600);
    font-weight: 600;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-weight: 500;
    width: fit-content;
}

.delete-btn {
    padding: 0.5rem;
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    opacity: 0;
}

.shopping-item:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    background: var(--red-100);
    color: var(--red-500);
}

.swipe-delete-indicator {
    position: absolute;
    right: -80px;
    background: var(--red-500);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

/* Quick add bar */
.quick-add-bar {
    position: fixed;
    bottom: 4.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 3rem);
    max-width: 550px;
    display: flex;
    gap: 0.75rem;
    background: white;
    padding: 0.75rem;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    z-index: 50;
}

.quick-add-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    font-size: 1rem;
    font-family: 'Space Grotesk', sans-serif;
    outline: none;
    transition: border-color 0.2s ease;
}

.quick-add-input:focus {
    border-color: var(--teal-400);
}

.quick-add-btn {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--teal-500) 0%, var(--teal-600) 100%);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-add-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

.quick-add-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Control bar */
.control-bar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    padding: 1rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.item-counter {
    color: var(--gray-500);
    font-size: 0.9rem;
}

.control-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.control-btn {
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border: none;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--gray-100);
    color: var(--gray-600);
    font-family: 'Space Grotesk', sans-serif;
}

.control-btn:hover:not(:disabled) {
    background: var(--gray-200);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.control-btn.danger:hover:not(:disabled) {
    background: var(--red-100);
    color: var(--red-500);
}

.control-btn.primary {
    background: linear-gradient(135deg, var(--teal-500) 0%, var(--teal-600) 100%);
    color: white;
}

.control-btn.primary:hover {
    box-shadow: 0 4px 15px rgba(20, 184, 166, 0.3);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1rem;
}

.modal-content {
    background: white;
    padding: 1.5rem;
    border-radius: 20px;
    text-align: center;
    max-width: 300px;
    width: 100%;
}

.modal-content p {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 1.5rem;
}

.modal-buttons {
    display: flex;
    gap: 0.75rem;
}

.modal-btn {
    flex: 1;
    padding: 0.75rem;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Space Grotesk', sans-serif;
}

.modal-btn.cancel {
    background: var(--gray-100);
    color: var(--gray-600);
}

.modal-btn.confirm {
    background: var(--red-500);
    color: white;
}

/* Footer */
.app-footer {
    padding: 1rem;
    text-align: center;
    color: var(--gray-400);
    font-size: 0.85rem;
}

.app-footer a {
    color: var(--gray-500);
    text-decoration: none;
    transition: color 0.2s ease;
}

.app-footer a:hover {
    color: var(--teal-500);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 10rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 500;
    z-index: 300;
    animation: slideUp 0.3s ease;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Confetti */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 400;
    overflow: hidden;
}

.confetti-particle {
    position: absolute;
    top: -10px;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    animation: confettiFall 3s ease forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 480px) {
    .app-header {
        padding: 1.25rem 1rem;
    }
    
    .header-title h1 {
        font-size: 1.5rem;
    }
    
    .main-content {
        padding: 1rem;
        padding-bottom: 7rem;
    }
    
    .mic-button {
        width: 90px;
        height: 90px;
    }
    
    .control-buttons {
        width: 100%;
    }
    
    .control-btn {
        flex: 1;
        min-width: 0;
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .quick-add-bar {
        bottom: 4rem;
        width: calc(100% - 2rem);
    }
    
    .delete-btn {
        opacity: 1;
    }
}

@media (min-width: 768px) {
    .shopping-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .category-group {
        margin-bottom: 0;
    }
}