/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-green: #2E7D32;
    --secondary-green: #4CAF50;
    --light-green: #81C784;
    --accent-green: #66BB6A;
    --dark-green: #1B5E20;
    --success-green: #4CAF50;
    --bg-gradient: linear-gradient(135deg, #E8F5E8 0%, #F1F8E9 50%, #E0F2F1 100%);
    --card-shadow: 0 4px 20px rgba(46, 125, 50, 0.1);
    --hover-shadow: 0 8px 30px rgba(46, 125, 50, 0.15);
    --border-radius: 16px;
    --border-radius-sm: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: #2E3440;
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    width: 100%;
    margin: 0;
    min-height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    overflow: hidden;
    position: relative;
}

.app-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-green), var(--secondary-green), var(--accent-green), var(--light-green));
    background-size: 200% 100%;
    animation: gradientShift 3s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--primary-green), var(--secondary-green));
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.app-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.app-header:hover::before {
    transform: translateX(100%);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    z-index: 1;
    position: relative;
}

.logo {
    width: 42px;
    height: 42px;
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.95);
    padding: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: var(--transition);
    object-fit: cover;
    object-position: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
    max-width: 42px;
    max-height: 42px;
    overflow: hidden;
}

.logo:hover {
    transform: scale(1.08) rotate(2deg);
    border-color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.app-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    z-index: 1;
    position: relative;
}

/* Buttons */
.btn {
    padding: 1rem 1.5rem;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    letter-spacing: 0.025em;
    min-height: 56px;
    white-space: nowrap;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary-green), var(--accent-green));
    color: white;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-green), var(--light-green));
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: linear-gradient(135deg, #E53E3E, #C53030);
    color: white;
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #C53030, #9C2A2A);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(229, 62, 62, 0.4);
}

.btn-edit {
    background: linear-gradient(135deg, #3182CE, #2B77CB);
    color: white;
    box-shadow: 0 4px 12px rgba(49, 130, 206, 0.3);
}

.btn-edit:hover {
    background: linear-gradient(135deg, #2B77CB, #2C5AA0);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(49, 130, 206, 0.4);
}

.btn-install {
    background: linear-gradient(135deg, #8B5CF6, #7C3AED);
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    animation: pulse 2s infinite;
}

.btn-install:hover {
    background: linear-gradient(135deg, #7C3AED, #6D28D9);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
    animation: none;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    }
    50% {
        box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
    }
}

/* Main Content */
.main-content {
    padding: 2rem;
    position: relative;
}

/* Add Item Form */
.add-item-section {
    margin-bottom: 2.5rem;
}

.add-item-form {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(248, 250, 252, 0.9));
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(46, 125, 50, 0.1);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.add-item-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--secondary-green), var(--accent-green));
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-items: stretch;
}

@media (min-width: 768px) {
    .form-row {
        grid-template-columns: 2fr 1fr 1fr auto;
        align-items: end;
        gap: 1rem;
    }
    
    .form-row input {
        padding: 0.75rem;
        font-size: 0.95rem;
        min-height: 44px;
    }
    
    .form-row .btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        min-height: 44px;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-green);
    margin-bottom: 0.25rem;
}

.form-row input {
    padding: 0.875rem 1rem;
    border: 2px solid rgba(46, 125, 50, 0.2);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    min-height: 48px;
}

.form-row input:focus {
    outline: none;
    border-color: var(--secondary-green);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
    transform: translateY(-2px);
}

.form-row input::placeholder {
    color: #94A3B8;
    font-weight: 400;
}

/* Grocery List */
.grocery-list-section {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.95));
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(46, 125, 50, 0.1);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.grocery-list-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-green), var(--light-green));
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid rgba(46, 125, 50, 0.1);
    position: relative;
}

.list-header h2 {
    color: var(--primary-green);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.list-header h2::before {
    content: '📋';
    font-size: 1.5rem;
}

.list-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--primary-green);
    text-align: right;
}

.list-stats span {
    background: rgba(46, 125, 50, 0.1);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    backdrop-filter: blur(5px);
}

.grocery-list {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #64748B;
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.8), rgba(241, 245, 249, 0.8));
    border-radius: var(--border-radius);
    border: 2px dashed rgba(46, 125, 50, 0.2);
}

.empty-state p:first-child {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--primary-green);
}

.empty-state::before {
    content: '🛒';
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

/* Grocery Item */
.grocery-item {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.9));
    border: 2px solid rgba(46, 125, 50, 0.15);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    transition: var(--transition);
    position: relative;
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.grocery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--secondary-green), var(--accent-green));
    transform: scaleY(0);
    transition: transform 0.3s ease;
    transform-origin: bottom;
}

.grocery-item:hover::before {
    transform: scaleY(1);
}

.grocery-item:hover {
    border-color: var(--secondary-green);
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--hover-shadow);
}

.grocery-item.completed {
    opacity: 0.75;
    background: linear-gradient(135deg, rgba(241, 245, 249, 0.9), rgba(248, 250, 252, 0.8));
    border-color: rgba(100, 116, 139, 0.3);
}

.grocery-item.completed::before {
    background: linear-gradient(180deg, #64748B, #94A3B8);
    transform: scaleY(1);
}

.grocery-item.completed .item-name {
    text-decoration: line-through;
    color: #64748B;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.item-info {
    flex: 1;
    padding-left: 1rem;
}

.item-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary-green);
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.item-details {
    display: flex;
    gap: 1.5rem;
    color: #64748B;
    font-size: 0.875rem;
    font-weight: 500;
}

.item-details span {
    background: rgba(46, 125, 50, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

.item-actions {
    display: flex;
    gap: 0.75rem;
    opacity: 0;
    transition: var(--transition);
    align-items: center;
}

.grocery-item:hover .item-actions {
    opacity: 1;
    transform: translateX(0);
}

.item-actions .btn {
    padding: 0.25rem;
    font-size: 0.8rem;
    min-width: 42px;
    height: 18px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.item-actions .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.item-actions .btn:hover::before {
    left: 100%;
}

.item-actions .btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.btn-edit {
    background: linear-gradient(135deg, #3B82F6, #1D4ED8);
    border-color: rgba(59, 130, 246, 0.3);
}

.btn-edit:hover {
    background: linear-gradient(135deg, #1D4ED8, #1E40AF);
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #DC2626, #B91C1C);
    border-color: rgba(239, 68, 68, 0.6);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(46, 125, 50, 0.05);
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(46, 125, 50, 0.1);
}

.checkbox-container input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--secondary-green);
    border-radius: 4px;
}

.checkbox-container label {
    font-weight: 600;
    color: var(--primary-green);
    cursor: pointer;
    user-select: none;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 1.5rem;
}

/* Share URL */
.share-url-container {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.share-url-container input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 0.9rem;
}



/* Install Prompt */
.install-prompt {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 999;
    animation: slideUp 0.3s ease;
}

.install-content {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.install-icon {
    font-size: 2rem;
}

.install-text {
    flex: 1;
}

.install-text strong {
    display: block;
    margin-bottom: 0.25rem;
}

.install-text p {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
}

.install-actions {
    display: flex;
    gap: 0.5rem;
}

.install-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        width: 100%;
        margin: 0;
        min-height: 100vh;
    }
    
    .app-header {
        padding: 1.25rem 1rem;
    }
    
    .header-logo {
        gap: 1rem;
    }
    
    .logo {
        width: 36px;
        height: 36px;
        padding: 3px;
        max-width: 36px;
        max-height: 36px;
    }
    
    .app-header h1 {
        font-size: 1.5rem;
    }
    
    .header-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .header-actions .btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        min-height: 48px;
        width: 100%;
        justify-content: center;
    }
    
    .main-content {
        padding: 1.5rem 1rem;
    }
    
    .add-item-form {
        padding: 1.5rem;
    }
    
    .grocery-list-section {
        padding: 1.5rem;
    }
    
    .list-stats {
        flex-direction: row;
        gap: 0.75rem;
        flex-wrap: wrap;
    }
    
    .list-stats span {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .list-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .list-stats {
        flex-direction: column;
        gap: 0.25rem;
        font-size: 0.9rem;
    }
    
    .item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .item-actions {
        align-self: flex-end;
    }
    
    .install-content {
        flex-direction: column;
        text-align: center;
    }
    
    .install-actions {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .share-url-container {
        flex-direction: column;
    }
    
    .item-details {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .item-actions .btn {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }
}